Error reading repository - Error 410

My company uses private Gitlab installation (let’s call it, and some Goland projects are referencing other private repositories as dependencies.

I was very perplexed when, while downloading such dependencies with go get (those projects were not under go mod), I got a following error:

1reading[email protected]: 410 Gone

Turns out, that from go 1.13, a proxy is used to resolve packages

When resolving a package path to its containing module, the go command will try all candidate module paths on each proxy in the list in succession. An unreachable proxy or HTTP status code other than 404 or 410 terminates the search without consulting the remaining proxies.

and since that proxy cannot access a private repository, a 410 error is being thrown.

Fortunately it’s fairly simple fix:

The new GOPRIVATE environment variable indicates module paths that are not publicly available. It serves as the default value for the lower-level GONOPROXY and GONOSUMDB variables, which provide finer-grained control over which modules are fetched via proxy and verified using the checksum database.

Just create an environmental variable (or put it directly in your .bashrc file) with following value

1export GOPRIVATE=",,,"

As you can see, it’s possible to set a specific rule for a specific repositories, or on a global level (for some specific domain)