Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/tools/gopls: Default setting of GOPROXY=off causes problems with downloading modules #53313

Closed
Jefftree opened this issue Jun 9, 2022 · 7 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@Jefftree
Copy link

Jefftree commented Jun 9, 2022

gopls version

golang.org/x/tools/gopls v0.7.5
    golang.org/x/tools/gopls@v0.7.5 h1:8Az52YwcFXTWPvrRomns1C0N+zlgTyyPKWvRazO9GG8=

go env

What did you do?

Hi, I recently upgraded from a gopls version from over a year ago (0.1.0). I was getting an error module lookup disabled by GOPROXY=off but my project (kubernetes) has no private repos. (It does use a mod file with replace directives and a vendor directory).

As a fix, I was able to fix the problem via toggling allowImplicitNetworkAccess, but it looks like this is not recommended. I'm not sure if this is a problem with my environment or the go.mod for Kubernetes (everything works smoothly for other repos).

Editor and settings

Emacs, using lsp-mode and gopls

Logs

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Jun 9, 2022
@gopherbot gopherbot added this to the Unreleased milestone Jun 9, 2022
@jamalc
Copy link

jamalc commented Jun 9, 2022

Is this a problem only when the mod file changes or during startup as well?

@jamalc jamalc added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jun 9, 2022
@Jefftree
Copy link
Author

Jefftree commented Jun 9, 2022

startup as well

@findleyr
Copy link
Contributor

findleyr commented Jun 9, 2022

Hmm, the initial workspace load is supposed to allow network access.

Also: does go build succeed from the command line?

Could you share logs from your gopls session?
https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md#capture-logs

@suzmue suzmue added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Jun 16, 2022
@rski
Copy link

rski commented Jun 17, 2022

for what it's worth, NixOS/nixpkgs#177632 was diagnosed to be due to dns resolution issues. I will open another issue because the error ends up being misleading and that is a problem of itself, but maybe there are dns issues going on here too?

@dle8
Copy link

dle8 commented Jun 23, 2022

@Jefftree: can you respond to @findleyr questions? Also is this the dns issue in your case like @rski mentioned?

@WhyNotHugo
Copy link

Regarding the above mention on NixOS/nixpkgs#177632, see #53676

@hyangah
Copy link
Contributor

hyangah commented Jul 6, 2022

As explained in #53676 (comment) GOPROXY=off setting is intentional to prevent implicit network access - previously, the go command gopls depends on went to the network at the unexpected moment and causes unpredictable delays, so gopls attempts to control the network access by setting GOPROXY=off when necessary.

Ideally, the required modules should be already locally available in the module cache, or users should explicitly request to download them (go build, go mod tidy commands, or various code lenses and quick fixes in go.mod files or in the import statements). Gopls also attempts to download the missing modules when it starts (aka initial package loading), but it sounds like the initial package loading failed due to the network issue, and the subsequent GOPROXY=off error message distracted users. Since there is another issue open (#53676), let's follow up the issue there.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

9 participants