What does import do in go?

Or, for example, does the last bit of import at the top of main here cause the code to access that website?

Thanks!

It is how dependencies are imported.

Thanks @SkewedZeppelin . Good. So these includes only “hit” a website, then redirect and pull source from a google website, in the process of building. Not when running the program.

./main.go: "mvdan.cc/fdroidcl/basedir" => https://pkg.go.dev/mvdan.cc/fdroidcl/basedir

./install.go: "mvdan.cc/fdroidcl/adb" => https://pkg.go.dev/mvdan.cc/fdroidcl/adb

./install.go: "mvdan.cc/fdroidcl/fdroid" => https://pkg.go.dev/mvdan.cc/fdroidcl/fdroid

So,

I like the move away from microsoft’s github. Not so much the move onto google.

Why would you set things up like this, rather than including directly from go dot dev? To provide future flexibility to conveniently redirect somewhere else? @mvdan?

Yes, the imports only need to be resolved at build time.

And yes, I moved the imports from github.com to my own domain to reduce the reliance on GitHub long-term. The code is still hosted on github.com for now, but I can change mvdan.cc/fdroidcl to point to a different git repository without breaking users.

I think you’re getting confused with pkg.go.dev though. That just shows documentation, and is not used while building. During a normal build in a clean machine, you should only see downloads from https://proxy.golang.org. If you want to avoid going through the proxy, you can build with GOPROXY=direct and you’ll instead see the downloads from github.com.

1 Like

Confused is my middle name. :smiley: I wasn’t using git; I was just clicking around with a browser and observed the browser get redirected, and wondered why. Thanks for clearing it up!