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

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Sep 16, 2020

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
Copy link
Contributor Author

@stamblerre stamblerre commented Sep 16, 2020

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

@gopherbot gopherbot commented Oct 1, 2020

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 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

@stamblerre stamblerre commented Dec 6, 2020

@heschik is there any work left here?

@heschi
Copy link
Contributor

@heschi heschi commented Dec 7, 2020

I suppose not.

@heschi heschi closed this Dec 7, 2020
vscode-go: gopls by default automation moved this from In progress to Done Dec 7, 2020
@stamblerre stamblerre removed this from the gopls/vscode-go milestone Dec 7, 2020
@stamblerre stamblerre added this to the gopls/v0.6.0 milestone Dec 7, 2020
@golang golang locked and limited conversation to collaborators Dec 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants