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

Open
stamblerre opened this issue Sep 16, 2020 · 2 comments
Open

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

stamblerre opened this issue Sep 16, 2020 · 2 comments
Labels
Milestone

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

@stamblerre stamblerre added this to Critical in gopls/v1.0.0 Sep 16, 2020
@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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.