'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



Solution 1:[1]

As mentioned in a comment to the question, restarting Visual Studio Code from the same environment where one exported the variables solves the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amal Thundiyil