Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

module lookup disabled by GOPROXY=off, but go env shows GOPROXY is set

When trying to lookup some modules, I am having an issue from VS Code where the error pictured below indicates that my GOPROXY is set to off, but when I run go env, I see that GOPROXY is actually set:GOPROXY="https://repo1.mycompany.com/artifactory/api/go/golang-virtual,https://proxy.golang.org,direct"

I have tried setting GONOPROXY='', as this comment suggests, but after running export GONOPROXY= or export GONOPROXY="", and checking go env in a new terminal tab, GONOPROXY is still set to: GONOPROXY="*.mycompany.com"

Running go mod tidy as VS Code suggests, results in the same error message.

Is it possible that my go env values are being set somewhere that I don't know about, maybe a different version of Go's env vars? Thanks in advance, any help is greatly appreciated.

VS Code's error screenshot: enter image description here

like image 306
Andrew Smith Avatar asked Sep 03 '25 16:09

Andrew Smith


2 Answers

Simply Ctrl + Shift + P > Developer: Reload window

enter image description here

like image 132
ABDULLOKH MUKHAMMADJONOV Avatar answered Sep 05 '25 15:09

ABDULLOKH MUKHAMMADJONOV


The latest docs have updated the GOPROXY flag proxy.golang.org, which states:

To opt-out of this module mirror, you can turn it off by setting GOPROXY=direct

So to bypass the proxy and fetch directly from the URLs in go.mod:

export GOPROXY=direct

go clean --modcache
go get -u
go build
like image 32
Josh Hibschman Avatar answered Sep 05 '25 15:09

Josh Hibschman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!