Discovered while investigating #54147: with "experimentalUseInvalidMetadata" set, we may diagnose a package with invalid metadata, and not re-diagnose when new metadata arrives. This can lead to diagnostics which are stale until you begin typing again.
We could fix this by re-diagnosing after each metadata load, but more generally we should reconsider whether it is worth landing this feature:
Pros:
when the workspace is totally broken, gopls will continue to work
Cons:
though gopls will continue to work, it may have inconsistent or confusing state
users should generally fix broken workspaces before doing anything else
we really don't want users to have to restart gopls, so in all other respects we are trying to avoid places where gopls "remembers history"
The text was updated successfully, but these errors were encountered:
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
Aug 1, 2022
To support the experimentalUseInvalidMetadata mode, we keep around
invalid metadata. This can help gopls features work when, for example,
the go.mod file is broken. It is debatable whether this feature is worth
supporting (see golang/go#54180), but in the meantime there is a very
negative side-effect when module paths are changed in the go.mod file:
we keep around a bunch of workspace packages with a stale module path.
As a result we can be left with a lots of extra type-checked packages
in memory, and many inaccurate diagnostics.
Fix this by skipping packages with invalid metadata when computing
workspace packages. While we may want to use invalid metadata when
finding the best package for a file, it does not make sense to re-
type-check and diagnose all those stale packages.
Fixesgolang/go#43186
Change-Id: Id73b47ea138ec80a9de63b03dae41d4e509b8d5a
Reviewed-on: https://go-review.googlesource.com/c/tools/+/420956
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
findleyr commentedAug 1, 2022
Discovered while investigating #54147: with "experimentalUseInvalidMetadata" set, we may diagnose a package with invalid metadata, and not re-diagnose when new metadata arrives. This can lead to diagnostics which are stale until you begin typing again.
We could fix this by re-diagnosing after each metadata load, but more generally we should reconsider whether it is worth landing this feature:
Pros:
Cons:
The text was updated successfully, but these errors were encountered: