如使用go env -w GOPROXY=https://goproxy.cn,direct设置时报以下错误

go env -w GOPROXY=***
warning: go env -w GOPROXY=... does not override conflicting OS environment variable

原因:

之前安装时,用环境变量的方式设置过代理地址 或设置错误,go13提供了-w参数来设置GOPROXY变量,但无法覆盖OS级别的环境变量

解决方法:

unset  GOPROXY

设置GO111MODULE=on

# windows下临时生效
set GO111MODULE=on

# linux下临时生效
export GO111MODULE=on

# 永久生效
go env -w GO111MODULE=on

阿里云:https://mirrors.aliyun.com/goproxy
微软:https://goproxy.io
七牛云:https://goproxy.cn
GoCenter:https://gocenter.io

作者:joker.liu  创建时间:2021-07-19 16:00
最后编辑:joker.liu  更新时间:2023-05-12 14:15