Your Go Modules Don't Need GitHub

Go resolves imports over HTTPS using one HTML meta tag — not by cloning GitHub. Own your import path, move hosts, and keep builds alive.

Share

One of this weekend's bigger threads — "Don't couple your Go code to GitHub" — sounds like style advice. It's really about a mechanism most Go developers never see: the go tool doesn't resolve imports by talking to GitHub. It resolves them over plain HTTPS, using an HTML meta tag that can point anywhere.

Which means the github.com/you/pkg in your users' go.mod files is a name, not an address. The address gets decided at request time — and you can own the DNS that decides it.

Why this matters

Code hosts churn: renames, acquisitions, suspended accounts, outages. If your import path is your GitHub path, every one of those events breaks downstream builds at once. And the "fix" is a path bump that changes no code.

Here's the part most people miss: with the default GOPROXY=https://proxy.golang.org,direct, builds barely touch your git host anyway. The proxy fetches each version once, zips it, and caches