internal/lsp/cache: report analysis panics during testing
Report a bug when an analysis dependency is found to be
neither "vertical" (for facts) or "horizontal" (for results).
This has been observed in practise: the lookup from a package
ID to a package object is not consistent.
The bug report is suppressed for command-line-arguments
packages to see whether it occurs on ordinary packages too.
Also, add disabled logic to disable recovery and dump all
goroutines, for temporary use when debugging.
Unrelated things found during debugging:
- simplify package key used in analysis cache: the mode is
always the same constant.
- move TypeErrorAnalyzers logic closer to where needed.
Updates golang/go#54655
Updates golang/go#54762
Change-Id: I0c2afd9ddd4fcc21748a03f8fa0769a2de09a56f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/426018
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go
index 4398142..d1d2b1f 100644
--- a/gopls/internal/lsp/cache/snapshot.go
+++ b/gopls/internal/lsp/cache/snapshot.go
@@ -1880,7 +1880,7 @@
var actionsToDelete []actionKey
s.actions.Range(func(k, _ interface{}) {
key := k.(actionKey)
- if _, ok := idsToInvalidate[key.pkg.id]; ok {
+ if _, ok := idsToInvalidate[key.pkgid]; ok {
actionsToDelete = append(actionsToDelete, key)
}
})