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: save old metadata before invalidating #42266

Closed
stamblerre opened this issue Oct 29, 2020 · 3 comments
Closed

x/tools/gopls: save old metadata before invalidating #42266

stamblerre opened this issue Oct 29, 2020 · 3 comments
Assignees
Milestone

Comments

@stamblerre
Copy link
Contributor

@stamblerre stamblerre commented Oct 29, 2020

We currently invalidate metadata before reloading, so we may lose metadata if something has changed an a given package is now unloadable. We should instead follow the approach taken in https://golang.org/cl/261237, and invalidate metadata only after we've successfully reloaded it.

@gopherbot
Copy link

@gopherbot gopherbot commented Dec 6, 2020

Change https://golang.org/cl/271477 mentions this issue: internal/lsp/cache: don't delete metadata until it's reloaded

@stamblerre stamblerre moved this from Critical to In progress in vscode-go: gopls by default Dec 6, 2020
@stamblerre stamblerre removed this from In progress in vscode-go: gopls by default Dec 16, 2020
@stamblerre stamblerre added this to To Do in gopls: v1.0.0 Feb 28, 2021
gopherbot pushed a commit to golang/tools that referenced this issue May 19, 2021
This CL moves to a model where we don't automatically delete invalidated
metadata, but rather preserve it and mark it invalid. This way, we can
continue to use invalid metadata for all features even if there is an
issue with the user's workspace.

To keep track of the metadata's validity, we add an invalid flag to
track the status of the metadata. We still reload at the same rate--the
next CL changes the way we reload data.

We also add a configuration to opt-in (currently, this is off by
default).

In some cases, like switches between GOPATH and module modes, and when a
file is deleted, the metadata *must* be deleted outright.

Updates golang/go#42266

Change-Id: Iff5e10b641fdb4be270af0cd887a10ee97ac1a19
Reviewed-on: https://go-review.googlesource.com/c/tools/+/271477
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
@gopherbot
Copy link

@gopherbot gopherbot commented May 27, 2021

Change https://golang.org/cl/322972 mentions this issue: internal/lsp: wait for metadata to reload before running analysis

@gopherbot
Copy link

@gopherbot gopherbot commented Jun 7, 2021

Change https://golang.org/cl/324394 mentions this issue: internal/lsp/cache: don't delete metadata until it's reloaded

gopherbot pushed a commit to golang/tools that referenced this issue Jun 16, 2021
Retrying CL 271477, this time with parts of CL 322650 incorporated.

This CL moves to a model where we don't automatically delete invalidated
metadata, but rather preserve it and mark it invalid. This way, we can
continue to use invalid metadata for all features even if there is an
issue with the user's workspace.

To keep track of the metadata's validity, we add an invalid flag to
track the status of the metadata. We still reload at the same rate--the
next CL changes the way we reload data.

We also add a configuration to opt-in (currently, this is off by
default).

In some cases, like switches between GOPATH and module modes, and when a
file is deleted, the metadata *must* be deleted outright.

Also, handle an empty GOMODCACHE in the directory filters (from a
previous CL).

Updates golang/go#42266

Change-Id: Idc778dc92cfcf1e4d14116c79754bcca0229e63d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/324394
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
@stamblerre stamblerre closed this Jun 16, 2021
gopls: v1.0.0 automation moved this from To Do to Done Jun 16, 2021
@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.7.1 Jun 16, 2021
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