[Golang]-9 Go Bulid 打包报错:A connection attempt failed……解决方法

现象

打包出现下面的错误

go build

go: github.com/auth0/go-jwt-middleware@v0.0.0-20190805220309-36081240882b: Get "https://proxy.golang.org/github.com/auth0/go-jwt-middleware/@v/v0.0.0-20190805220309-36081240882b.mod": dial tcp 216.58.200.241: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.mod 代理连接出错

解决方法

go.mod 设置代理

golang1.13.x 在命令行中可以直接执行:

go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
posted @ 2021-03-12 14:58  哆啦梦乐园  阅读(990)  评论(0编辑  收藏  举报