问题描述
go语言编译后控制台报错
go: github.com/gin-contrib/sessions@v0.0.3: Get "https://proxy.golang.org/github.com/gin-contrib/sessions/@v/v0.0.3.mod": dial tcp 142.251.43.17: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.
问题解决
默认GoPROXY配置是:GOPROXY=https://proxy.golang.org,direct,由于国内访问不到https://proxy.golang.org,所以我们需要换一个PROXY,这里推荐使用https://goproxy.io或https://goproxy.cn。
go env -w GOPROXY=https://goproxy.cn,direct