【GoLand】go语言入门常见报错——Get “https://proxy.golang.org/github.com/gin-contrib/sessions/@v/v0.0.3.mod“

问题描述

go语言编译后控制台报错
go: github.com/gin-contrib/[email protected]: 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

你可能感兴趣的:(go语言,golang,开发语言,后端,go)