go/gopls/internal/regtest
Robert Findley 01c9ff0536 internal/lsp/cache: invalid packages should not be workspace packages
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.

Fixes golang/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>
2022-08-04 18:51:19 +00:00
..
bench gopls/internal/regtest/bench: refactor and improve benchmarks 2022-08-04 14:58:59 +00:00
codelens internal/lsp/source: don't crash requesting gc_details for an empty file 2022-08-02 18:19:01 +00:00
completion internal/lsp/regtest: only run /default tests with -short 2022-07-26 21:20:53 +00:00
debug internal/lsp/regtest: allow sharing memoized results across regtests 2022-07-26 21:20:42 +00:00
diagnostics gopls/internal/regtest/bench: refactor and improve benchmarks 2022-08-04 14:58:59 +00:00
inlayhints internal/lsp/regtest: simplify, consolidate, and document settings 2022-07-12 16:56:46 +00:00
misc internal/lsp/command: let RunVulncheckExp call gopls vulncheck 2022-08-04 18:21:12 +00:00
modfile gopls/internal/regtest/bench: refactor and improve benchmarks 2022-08-04 14:58:59 +00:00
template gopls/internal/regtest/bench: refactor and improve benchmarks 2022-08-04 14:58:59 +00:00
watch internal/lsp: re-send diagnostics on file events 2022-08-02 18:52:36 +00:00
workspace internal/lsp/cache: invalid packages should not be workspace packages 2022-08-04 18:51:19 +00:00