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: enable network usage whenever reinitializing the workspace #54069

Closed
2 tasks
findleyr opened this issue Jul 26, 2022 · 2 comments
Closed
2 tasks
Assignees
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.
Milestone

Comments

@findleyr
Copy link
Contributor

This is an umbrella issue for visibility. We plan to change the default gopls behavior to allow network usage whenever "reinitializing" the workspace (which happens whenever a go.mod or go.work file is saved).

Currently, gopls only allows network usage during the initial workspace load. In all subsequent go command invocations, it sets GOPROXY=off. The original rationale for this is #38462, which was reporting poor behavior without internet because gopls uses the go command to compute go mod tidy diagnostics. To fix this, we set GOPROXY=off while running go mod tidy. However, at the time, any typing in a go.mod file would trigger a reinitialization, so it was decided to also disable network when reinitializing.

But this can lead to a confusing user experience, in part because the GOPROXY=off error message leaks, and in part because this is an example where restarting gopls can lead to a different state (because redo-ing the initial workspace load will allow network and fix problems).

Specifically, we have at least the following open issues:

Now that we only reinitialize on a go.work or go.mod file save, reinitialization should be infrequent. We should allow network, so that reinitialization has the same result as the initial workspace load.

@findleyr findleyr added this to the gopls/v0.9.2 milestone Jul 26, 2022
@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 Jul 26, 2022
@gopherbot
Copy link

Change https://go.dev/cl/419500 mentions this issue: internal/lsp/cache: allow network whenever reloading the workspace

gopherbot pushed a commit to golang/tools that referenced this issue Jul 27, 2022
Per the explanation at golang/go#54069, allow network access whenever
loading the workspace. Enable one test that exercises this behavior.
More tests will be added in subsequent CLs.

Updates golang/go#47540
Updates golang/go#53676
Updates golang/go#54069

Change-Id: I9c3bb19d36702bc6b8051bee6b7cddaec5b97c0c
Reviewed-on: https://go-review.googlesource.com/c/tools/+/419500
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
@findleyr
Copy link
Contributor Author

findleyr commented Aug 4, 2022

This was done by https://go.dev/cl/419500

@findleyr findleyr closed this as completed Aug 4, 2022
@findleyr findleyr self-assigned this Aug 8, 2022
@golang golang locked and limited conversation to collaborators Aug 8, 2023
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.
Projects
None yet
Development

No branches or pull requests

2 participants