go/internal/lsp/analysis
Alan Donovan 7c5e03569b internal/lsp: fix suppressed panic in analyzer
This change ensures that the End position provided to span.NewRange
in suggestedAnalysisFixes is valid even when the diagnostic has
only a valid start position. This seems to be the cause of
some panics observed in the ARM builders in the attached issue.

Also, reduce the scope of the recover operation to just the analyzer's
run method: we don't want to hide further bugs (or discard stack traces)
in the setup or postprocessing logic.

Also:
- split a single assertion in span.NewRange into two.
- Add information to various error messages to help identify causes.
- Add TODO comments about inconsistent treatment of token.File
  in span.FileSpan, and temporarily remove bug.Errorf that
  is obviously reachable from valid inputs.
- Add TODO to fix another panic in an analyzer that is covered
  by our tests but was hitherto suppressed.
- Add TODO to use bug.Errorf after recover to prevent recurrences.
  We can't do that until the previous panic is fixed.

Updates https://github.com/golang/go/issues/54655

Change-Id: I0576d03fcfffe0c8df157cf6c6520c9d402f8803
Reviewed-on: https://go-review.googlesource.com/c/tools/+/425356
Run-TryBot: Alan Donovan <adonovan@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Suzy Mueller <suzmue@golang.org>
2022-08-26 15:28:25 +00:00
..
embeddirective internal/lsp/analysis: fix a doc comment typo 2022-05-11 23:42:05 +00:00
fillreturns internal/lsp: fix suppressed panic in analyzer 2022-08-26 15:28:25 +00:00
fillstruct internal/lsp: enable fillstruct for generics 2022-07-25 16:40:20 +00:00
infertypeargs internal/typeparams: simplify the IndexExpr API 2022-01-19 20:29:28 +00:00
nonewvars internal/lsp/analysis: add typeparams tests for nonewvars and noresultvalues 2021-10-13 04:56:02 +00:00
noresultvalues internal/lsp/analysis/noresultvalues: update for CL 379116 error message change 2022-01-18 21:28:05 +00:00
simplifycompositelit gopls: fix various staticcheck errors 2020-09-29 17:30:36 +00:00
simplifyrange
simplifyslice internal/lsp: add parameterized slice test for simplifyslice analysis 2021-10-01 15:56:03 +00:00
stubmethods internal/lsp/analysis/stubmethods: recognize *ast.CallExpr 2022-05-17 17:04:34 +00:00
undeclaredname internal: remove unneeded FileSets 2022-06-06 20:47:10 +00:00
unusedparams internal/lsp: add suggested fix for unusedparams analysis 2022-01-14 17:47:02 +00:00
unusedvariable internal/lsp/analysis/unusedvariable: add analyzer 2022-07-15 14:27:36 +00:00
useany internal/lsp/analysis: add a useany analyzer 2021-09-22 22:01:06 +00:00