How to fetch modules from private repository
Fix: go get private repository return error reading sum.golang.org/lookup … 410 gone 1
Fixing error: go get gomodule on private module with error message pattern verifying git-host… reading sum.golang.org/lookup … 410 gone 1
Using GOPRIVATE
As stated in the release doc of Go 1.13,
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.
export GOPRIVATE="gitlab.com/idmabar,bitbucket.org/idmabar,github.com/idmabar"
And to verify if this worked, you can do the go env
command.
(GOPRIVATE="gitlab.com/idmabar,bitbucket.org/idmabar,github.com/idmabar" go env) | grep GOPRIVATE
So this env-variable
will tell the go get
command to use the private host proxy to retrieve the package.
Using GONOSUMDB
Another solution, maybe using the GONOSUMDB variable.
So try to set this in as an environment variable:
export GONOSUMDB="gitlab.com/idmabar,bitbucket.org/idmabar,github.com/idmabar"
Actually this issue only happens in new Golang version 1.13 and afterward.
Miscellaneous
- clone repo and run
GOINSECURE=true go get
- troubleshooting
GOPRIVATE=gitlab.xyz.tech go get all
go clean --modcache
GOPRIVATE=gitlab.xyz.tech,xyz-github.corp go get all
- if any of those below…
verifying module - 404 Not Found
server response: not found
dial tcp: lookup - no such host
go get -insecure
-insecure
flag is no longer supported; useGOINSECURE
instead
- troubleshooting