命令
阿里云
go env -w GO111MODULE=ongo env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
goproxy.io
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.io,direct
七牛云 goproxy.cn
go env -w GO111MODULE=on
go env -w GOPROXY=https://goproxy.cn,direct
全设置
go env -w GO111MODULE=on
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,https://goproxy.io,https://goproxy.cn,direct
清空模块缓存
go clean --modcache
查看设置是否成功:
go env GOPROXY
参考资料
- 阿里云代理: https://mirrors.aliyun.com/goproxy/
- goproxy.io: https://goproxy.io/zh/
- 七牛云 goproxy.cn: https://goproxy.cn/
- goproxy.io 和 goproxy.cn 的关系: https://github.com/goproxy/goproxy.cn/issues/61
- GO111MODULE 解惑: https://learnku.com/go/t/39086
