[Solved] How to import a local file in my main package [closed]


I’ve read also that people where going to import everything from “GitHub.com”, but it makes no sense for me to first push my code to GitHub before I can test it in my local project.

You don’t have to push it anywhere before you can test it. You only have to choose what your import path is, and then put your code in GOPATH accordingly (or use go mod init with Go 1.11+, which lets you place your code anywhere in the filesystem you want). But you still have to pick that import path — even if you decide to change it later.

By the way, I’m also curious why go get will not fetch all sub-dependencies together with the specific library that will be fetch with go get?

It does.

1

solved How to import a local file in my main package [closed]