go get执行无法下载包,报warning: go env -w GOPROXY=... does not override conflicting OS environm

打开cmd,执行go env

C:\Users\86131>go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=D:\study\Go\GoProject\bin
set GOCACHE=C:\Users\86131\AppData\Local\go-build
set GOENV=C:\Users\86131\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\study\Go\GoProject\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\study\Go\GoProject
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\study\Go\GOROOT\go1.17.3
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\study\Go\GOROOT\go1.17.3\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\86131\AppData\Local\Temp\go-build1098379897=/tmp/go-build -gno-record-gcc-switches

打开goland命令行,执行go env

D:\study\Go\GoProject\src\gin_demo>go env
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=D:\study\Go\GoProject\bin
set GOCACHE=C:\Users\86131\AppData\Local\go-build
set GOENV=C:\Users\86131\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=D:\study\Go\GoProject\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=D:\study\Go\GoProject
set GOPRIVATE=
set GOPROXY=https://goproxy.cn
set GOROOT=D:\study\Go\GOROOT\go1.17.3
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\study\Go\GOROOT\go1.17.3\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.17.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=D:\study\Go\GoProject\src\gin_demo\go.mod
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\86131\AppData\Local\Temp\go-build3744853949=/tmp/go-build -gno-record-gcc-switches

经过对比:两个输出的GOPROXY的值不同

  • 一个是 set GOPROXY=https://goproxy.cn,direct
  • 另一个是 set GOPROXY=https://goproxy.cn

在其中一个配置set GOPROXY=https://goproxy.cn,direct 或者 set GOPROXY=https://goproxy.cn,配置成与另一个相同即可。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

龙域、白泽

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值