方法1,
将上述命令追加在 .bashrc
或 .bash_profile
文件中
# Enable the go modules feature
export GO111MODULE=on
# Set the GOPROXY environment variable
export GOPROXY=https://goproxy.io
方法2,
高版本的go
如果你的Go语言版本环境大于等于1.13,则使用下列命令设置代理:
Go version >= 1.13
go env -w GOPROXY="https://goproxy.io"