Go 语言下载 module 超时
go
语言下载模块的默认地址是 https://proxy.golang.org
,而该网址在国内无法正常访问,若以该网址作为源加载模块则会出现下面的问题:
PS E:\Projects\Go\hello> go mod tidy
go: finding module for package rsc.io/quoteexample/hello imports
rsc.io/quote: module rsc.io/quote: Get "https://proxy.golang.org/rsc.io/quote/@v/list": dial tcp 142.251.42.241:443: i/o timeout
解决方法
将下载地址更换为国内的地址即可(https://goproxy.cn
),执行如下命令:
go env -w GOPROXY=https://goproxy.cn
在重新加载,不会出现 timeout
的问题。