go module 公共代理仓库,代理并缓存 go 模块,利用该代理来避免 DNS 污染导致的模块拉取缓慢或失败的问题,加速你的构建。
GOPROXY
使用 go1.11 以上版本并开启 go module 机制
goproxy.io
# Enable the go modules feature
export GO111MODULE=on
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io,direct
Aliyun
export GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
goproxy.cn
export GOPROXY=https://goproxy.cn,direct
goproxy 镜像搭建
docker run -p 8080:8080 ghcr.io/goproxy/goproxy server --address :8080
F&Q
配置 GoLand
unrecognized import path "golang.org/x/oauth2" (https fetch: Get https://golang.org/x/oauth2?go-get=1: dial tcp 216.239.37.1:443: i/o timeout)
参考:https://goproxy.io/ 设置 goproxy。
GoLand
—> Perferences
—> Go
—> Go Modules(vgo)
—> Proxy
;
注意: