给GO配置急速下载代理

给GO配置急速下载代理

两个代理都挺好用,如下:
https://goproxy.io/
https://goproxy.cn/

配置语法如下:

Bash (Linux or macOS)

# 配置 GOPROXY 环境变量
export GOPROXY=https://goproxy.io,direct
# 还可以设置不走 proxy 的私有仓库或组,多个用逗号相隔(可选)
export GOPRIVATE=git.mycompany.com,github.com/my/private

PowerShell (Windows)

# 配置 GOPROXY 环境变量
$env:GOPROXY = "https://goproxy.io,direct"
# 还可以设置不走 proxy 的私有仓库或组,多个用逗号相隔(可选)
$env:GOPRIVATE = "git.mycompany.com,github.com/my/private"

cmd (Windows)

# 配置 GOPROXY 环境变量
$ go env -w GO111MODULE=auto
$ go env -w GOPROXY=https://goproxy.cn,direct

关于GO111MODULE=auto是什么意思的链接:https://www.cnblogs.com/akidongzi/p/12780410.html

posted @ 2021-09-07 10:38  Abraverman  阅读(291)  评论(0编辑  收藏  举报