起因:
你有遇到过类似的问题吗?
编译Go项目时,会提示 unknown import path …A connection attempt failed because …
go: downloading github.com/stretchr/testify v1.4.0
go: downloading github.com/bitly/go-simplejson v0.5.0
testClient.go:7:2: unknown import path \”github.com/bitly/go-simplejson\”: Get https://goproxy.io/github.com/bitly/go-simplejson/@v/v0.5.0.zip: dial tcp 119.28.201.50: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.
截图如下(报错一行较长,截图截不全)
原因:
这是由于我在环境变量中设置了全局代理或goland内的局部代理(由于go get 依赖时常失败而设置.):
解决方法:
若配置过代理,则取消以上两个代理配置即可正常 go build 项目了~