Skip to content

x/tools/gopls: enable network usage whenever reinitializing the workspace #54069

@findleyr

Description

@findleyr

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.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions