Skip to content

Commit

Permalink
internal/lsp/cache: keep going on failed analyzers
Browse files Browse the repository at this point in the history
A single failed analyzer should not prevent others from reporting their
diagnostics. This is especially relevant as we work on updating
analyzers to support generic code.

Change-Id: If1d958347649a99df92701fc4a4574cb7020596b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/351550
Trust: Robert Findley <[email protected]>
Run-TryBot: Robert Findley <[email protected]>
gopls-CI: kokoro <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Rebecca Stambler <[email protected]>
  • Loading branch information
findleyr committed Sep 22, 2021
1 parent 2847958 commit c8db761
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/lsp/cache/analysis.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ func (s *snapshot) Analyze(ctx context.Context, id string, analyzers []*source.A
for _, ah := range roots {
diagnostics, _, err := ah.analyze(ctx, s)
if err != nil {
return nil, err
// Keep going if a single analyzer failed.
event.Error(ctx, fmt.Sprintf("analyzer %q failed", ah.analyzer.Name), err)
continue
}
results = append(results, diagnostics...)
}
Expand Down

0 comments on commit c8db761

Please sign in to comment.