x/tools/gopls: enable network usage whenever reinitializing the workspace #54069
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
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 runninggo 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:
GOPROXY=off
#53676, where the "GOPROXY=off" error leaks to the user and it is very confusing (because the user didn't set GOPROXY=off).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.
The text was updated successfully, but these errors were encountered: