I haven’t used the private library before, but I happened to encounter it today. Let’s sort out the solution
If you are using the go get private library, you will encounter the following error:
$ export GO111MODULE=on $ export GOPROXY=direct $ export GOSUMDB=off
Both go111module and goproxy are familiar, while gosumdb is described as follows:
We know that go will create one locally when go module is enabled go.sum File used to store encrypted checksums that depend on a specific version of the package. At the same time, go maintains the cache of downloaded packages, and calculates and records the encrypted checksums of each package when downloading. In normal operation, the go command checks against these precomputed checksums go.sum Files instead of recalculating them every time a command is called.
In daily development, the checksums for specific module versions never change. Each time you run or build, the go command passes through the local go.sum To check whether the checksums of its local cache copies are consistent. If the checksums do not match, the go command reports a security error and refuses to run the build or run. In this case, it’s important to find the correct checksums and make sure they are go.sum Error or download code is wrong. If go.sum If there is no downloaded module in, and the module is a public module, the go command will query the go checksums database to obtain the correct checksums and save the go.sum 。 If the downloaded code does not match the checksums, the go command reports the mismatch and exits.
Go 1.13 provides the gosumdb environment variable for configuring the service address (and public key) of the go checksums database. The default value is sum.golang.org ”This is also the official check sum database service provided by go (gopher in mainland China can use it sum.golang.google .cn)。
For safety reasons, it is recommended to keep gosumdb on. But if, for some reason, gosumdb cannot be accessed (or even sum.golang.google . CN), which can be turned off by the following command:
go env -w GOSUMDB=off
After gosumdb is shut down, only local go.sum Check and verify the packet.
Parameter test article: https://github.com/golang/go/issues/35164
Knowledge points supplement:
Solutions to go get timeout
go get gopkg.in/yaml . V2 timed out. It was found that it was blocked. The solution is as follows:
1. Installation golang.org/x/net
$ mkdir -p $GOPATH/src/golang.org/x/ $ git clone https://github.com/golang/net.git $GOPATH/src/golang.org/x/net $ go install net
2. Installation gopkg.in/yaml .v2
$ go get gopkg.in/yaml.v2
The above is the details of the problem and solution of “410 gone” prompted by golang’s go get private library. For more information about go get private library, please pay attention to other related articles in developeppaer!