关于 Go 包安装的问题

Installing github.com/uudashr/gopkgs/v2/cmd/gopkgs FAILED
Installing github.com/acroca/go-symbols FAILED
Installing github.com/haya14busa/goplay/cmd/goplay FAILED
Installing github.com/godoctor/godoctor FAILED
Installing github.com/stamblerre/gocode FAILED
Installing github.com/rogpeppe/godef FAILED
Installing github.com/sqs/goreturns FAILED

7 tools failed to install.

gopkgs:
Error: Command failed: C:\Go\bin\go.exe get -v github.com/uudashr/gopkgs/v2/cmd/gopkgs
go get github.com/uudashr/gopkgs/v2/cmd/gopkgs: module github.com/uudashr/gopkgs/v2/cmd/gopkgs: Get "https://proxy.golang.org/github.com/uudashr/gopkgs/v2/cmd/gopkgs/@v/list": dial tcp 172.217.160.113: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.
go get github.com/uudashr/gopkgs/v2/cmd/gopkgs: module github.com/uudashr/gopkgs/v2/cmd/gopkgs: Get "https://proxy.golang.org/github.com/uudashr/gopkgs/v2/cmd/gopkgs/@v/list": dial tcp 172.217.160.113: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.

go-symbols:
Error: Command failed: C:\Go\bin\go.exe get -v github.com/acroca/go-symbols
go get github.com/acroca/go-symbols: module github.com/acroca/go-symbols: Get "https://proxy.golang.org/github.com/acroca/go-symbols/@v/list": dial tcp 172.217.160.113: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.
go get github.com/acroca/go-symbols: module github.com/acroca/go-symbols: Get "https://proxy.golang.org/github.com/acroca/go-symbols/@v/list": dial tcp 172.217.160.113: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.

goplay:
Error: Command failed: C:\Go\bin\go.exe get -v github.com/haya14busa/goplay/cmd/goplay
go get github.com/haya14busa/goplay/cmd/goplay: module github.com/haya14busa/goplay/cmd/goplay: Get "https://proxy.golang.org/github.com/haya14busa/goplay/cmd/goplay/@v/list": dial tcp 172.217.160.113: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.
go get github.com/haya14busa/goplay/cmd/goplay: module github.com/haya14busa/goplay/cmd/goplay: Get "https://proxy.golang.org/github.com/haya14busa/goplay/cmd/goplay/@v/list": dial tcp 172.217.160.113: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.

godoctor:
Error: Command failed: C:\Go\bin\go.exe get -v github.com/godoctor/godoctor
go get github.com/godoctor/godoctor: module github.com/godoctor/godoctor: Get "https://proxy.golang.org/github.com/godoctor/godoctor/@v/list": dial tcp 172.217.160.113: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.
go get github.com/godoctor/godoctor: module github.com/godoctor/godoctor: Get "https://proxy.golang.org/github.com/godoctor/godoctor/@v/list": dial tcp 172.217.160.113: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.

gocode-gomod:
Error: Command failed: C:\Go\bin\go.exe get -v -d github.com/stamblerre/gocode
go get github.com/stamblerre/gocode: module github.com/stamblerre/gocode: Get "https://proxy.golang.org/github.com/stamblerre/gocode/@v/list": dial tcp 172.217.160.113: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.
go get github.com/stamblerre/gocode: module github.com/stamblerre/gocode: Get "https://proxy.golang.org/github.com/stamblerre/gocode/@v/list": dial tcp 172.217.160.113: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.

godef:
Error: Command failed: C:\Go\bin\go.exe get -v github.com/rogpeppe/godef
go get github.com/rogpeppe/godef: module github.com/rogpeppe/godef: Get "https://proxy.golang.org/github.com/rogpeppe/godef/@v/list": dial tcp 172.217.160.113: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.
go get github.com/rogpeppe/godef: module github.com/rogpeppe/godef: Get "https://proxy.golang.org/github.com/rogpeppe/godef/@v/list": dial tcp 172.217.160.113: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.

goreturns:
Error: Command failed: C:\Go\bin\go.exe get -v github.com/sqs/goreturns
go get github.com/sqs/goreturns: module github.com/sqs/goreturns: Get "https://proxy.golang.org/github.com/sqs/goreturns/@v/list": dial tcp 172.217.160.113: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.
go get github.com/sqs/goreturns: module github.com/sqs/goreturns: Get "https://proxy.golang.org/github.com/sqs/goreturns/@v/list": dial tcp 172.217.160.113: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.

总是提示这几个包下载失败,我的网是没问题的,翻了墙的,也查了一下教程,clone了那些东西,试了也是出错

go
讨论数量: 4
taadis

大多数 go 相关的包都在 github 上, 也就是国外, 出于网络和不可描述的墙的原因, 国内下载依赖包的时会形成超时/异常/错误等等各种喜不闻乐不见的原因.

但是有对应的解决办法, 就是在国内起个代理服务, 让你可以规避上述问题, 愉快的使用各种包.

但是默认的设置是直接指向国外的, 也就是没有经过代理.

所以需要手动调整下代理设置.

输入以下命令:

// 启用模块化
// Go 1.13+ 默认启用, 可以不用设置
go env -w GO111MODULE=on

// 设置代理
go env -w GOPROXY=https://goproxy.io,direct

然后再试试下载你想要的 Go 包还有问题嘛.

3年前 评论
YannKing 3年前
taadis (作者) 3年前
Play_soy_sauce 3年前
taadis (作者) 3年前
Wuli_taotao 3年前
taadis (作者) 3年前
pardon110

若是手动clone那些包,需要编译安装

3年前 评论

可以设置git代理呀

3年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!