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
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@stamblerre
Copy link
Contributor

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.

@stamblerre stamblerre added this to the gopls/unplanned milestone Oct 29, 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 Oct 29, 2020
@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default Nov 13, 2020
@stamblerre stamblerre moved this from Needs Triage to Critical in vscode-go: gopls by default Nov 13, 2020
@stamblerre stamblerre self-assigned this Nov 23, 2020
@gopherbot
Copy link

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

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

@gopherbot
Copy link

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>
gopls on-deck 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
@golang golang locked and limited conversation to collaborators Jun 16, 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. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
No open projects
Development

No branches or pull requests

2 participants