Skip to content

Commit 9b5e55b

Browse files
committed
gopls/internal/lsp/cache: disable strict analysis while we fix panics
We now understand the longstanding race causing panics in gopls analysis (the cache key for analysis handles is not correct, and can lead to cache hits for analysis of stale packages). It will take a little while to redesign our analysis caching, the simplest solution being to hang analysis results off of the actual package they are analyzing. In the meantime, suppress the panic as before, to eliminate flakes. For golang/go#55201 For golang/go#56035 Change-Id: I96600f186f9f31b67dae10c0a95a14fa73630571 Reviewed-on: https://go-review.googlesource.com/c/tools/+/442794 Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Alan Donovan <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 9ffaf69 commit 9b5e55b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

gopls/internal/lsp/cache/analysis.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ func actionImpl(ctx context.Context, snapshot *snapshot, deps []*actionHandle, a
258258
// discover this problem in regular packages.
259259
// For command-line-arguments we quietly abort the analysis
260260
// for now since we already know there is a bug.
261-
errorf := bug.Errorf // report this discovery
261+
262+
// Temporarily disable bug reporting due to golang/go#56035: using
263+
// bug.Errorf causes too many test flakes.
264+
// TODO(rfindley): switch back to bug.Errorf once panics are fixed.
265+
errorf := fmt.Errorf
266+
262267
if source.IsCommandLineArguments(pkg.ID()) {
263268
errorf = fmt.Errorf // suppress reporting
264269
}
@@ -364,9 +369,9 @@ func actionImpl(ctx context.Context, snapshot *snapshot, deps []*actionHandle, a
364369
// An Analyzer crashed. This is often merely a symptom
365370
// of a problem in package loading.
366371
//
367-
// We believe that CL 420538 may have fixed these crashes, so enable
368-
// strict checks in tests.
369-
const strict = true
372+
// We are aware of a likely cause for these panics: the actionHandle
373+
// cache key is not correct. In the meantime, disable strict mode.
374+
const strict = false
370375
if strict && bug.PanicOnBugs && analyzer.Name != "fact_purity" {
371376
// During testing, crash. See issues 54762, 56035.
372377
// But ignore analyzers with known crash bugs:

0 commit comments

Comments
 (0)