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: incorrect metadata invalidation when changing package name #52500

Closed
findleyr opened this issue Apr 22, 2022 · 1 comment
Closed
Labels
FrozenDueToAge gopls/metadata Issues related to metadata loading in gopls 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

@findleyr
Copy link
Contributor

Gopls doesn't correctly invalidate package data when moving a file to a new package:
https://cs.opensource.google/go/x/tools/+/master:internal/lsp/cache/snapshot.go;l=1842;drc=37590b385d564de6d3b0aedae2b5821b3f357d1d

As a result, it's pretty easy to break gopls' metadata by toggling package names. Repro: move a file from package x_test to package x, wait a second, then move it back to package x_test: the resulting file will not be contained in any package...

Filing this issue to track the fix, and to associate with the new gopls/metadata label.

@findleyr findleyr added the gopls/metadata Issues related to metadata loading in gopls label Apr 22, 2022
@findleyr findleyr added this to the gopls/v0.8.4 milestone Apr 22, 2022
@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 Apr 22, 2022
@gopherbot
Copy link

Change https://go.dev/cl/401795 mentions this issue: internal/lsp/cache: invalidate packages that have added files

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls/metadata Issues related to metadata loading in gopls gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

2 participants