这篇文章主要介绍了GOPROXY:解决go get golang.org/x包失败问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教
问题现象
当我们使用 go get
、go install
、go mod
等命令时,会自动下载相应的包或依赖包。
但由于众所周知的原因,类似于 golang.org/x/...
的包会出现下载失败的情况。
如下所示:
package golang.org/x/tools/cmd/goimports/...: unrecognized import path "golang.org/x/tools/cmd/goimports"
(https fetch: Get https://golang.org/x/tools/cmd/goimports?go-get=1:
dial tcp 216.239.37.1:443: connectex: A connection attempt failed
because the connected party did not properly respond after a period of time,
or established connection failed because connected host has failed to respond.)