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: switch default to -mod=readonly #41437

Closed
stamblerre opened this issue Sep 16, 2020 · 4 comments
Closed

x/tools/gopls: switch default to -mod=readonly #41437

stamblerre opened this issue Sep 16, 2020 · 4 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Soon This needs to be done soon. (regressions, serious bugs, outages) Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

In CLs 253799 and 254756, @heschik switched to explicitly using -mod=mod to preserve the current behavior of gopls with Go 1.16. Since -mod=mod will be deprecated, we need an alternative approach for the future.

A proposed solution has been to run go mod tidy before gopls runs go/packages.Load. This can be done with -modfile or in the temporary workspace module. This way, we preserve the existing behavior that allows users to edit modules that don't compile, but we still offer go mod tidy diagnostics. These diagnostics should be upgraded to errors (with Go 1.16).

/cc @jayconrod @findleyr

@stamblerre stamblerre added this to the gopls/v1.0.0 milestone Sep 16, 2020
@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 Sep 16, 2020
@stamblerre
Copy link
Contributor Author

Another thing: Our model of textual updates to the go.mod does not allow for analogous updates to the go.sum, so we should use go commands instead of edits wherever possible.

@gopherbot
Copy link

Change https://golang.org/cl/258803 mentions this issue: gopls: add a test that mirrors govim's -mod=readonly test

gopherbot pushed a commit to golang/tools that referenced this issue Oct 2, 2020
This isn't strictly necessary, but we've broken it a number of times,
and it's easier to have a regtest for it. When golang/go#41437 is resolved, we
might consider making this a -mod=mod test or something.

Also, added a wrapper for RunGoCommand.

Change-Id: I75db585549d84dacde9d3efbc6e02a7ba4e005aa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/258803
Reviewed-by: Heschi Kreinick <heschi@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Rebecca Stambler <rstambler@golang.org>
@stamblerre stamblerre added the Soon This needs to be done soon. (regressions, serious bugs, outages) label Nov 2, 2020
@stamblerre stamblerre added this to In progress in vscode-go: gopls by default Nov 10, 2020
@stamblerre
Copy link
Contributor Author

@heschik is there any work left here?

@heschi
Copy link
Contributor

heschi commented Dec 7, 2020

I suppose not.

@heschi heschi closed this as completed Dec 7, 2020
vscode-go: gopls by default automation moved this from In progress to Done Dec 7, 2020
@golang golang locked and limited conversation to collaborators Dec 7, 2021
@rsc rsc unassigned heschi Jun 23, 2022
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. Soon This needs to be done soon. (regressions, serious bugs, outages) Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

3 participants