mirror of
https://github.com/golang/go
synced 2024-11-18 08:14:41 -07:00
internal/lsp: disable nilness analyzer, unless staticcheck enabled
Users with staticcheck enabled will be more tolerant of increased RAM usage. We might be able to disable this check entirely once the next version of staticcheck is released with a similar analysis (https://staticcheck.io/docs/checks#SA5011). Change-Id: I1a844cc226e34e0f62222f12912797a6cc9d06e2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/219018 Run-TryBot: Rebecca Stambler <rstambler@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
e2a38c8363
commit
6822f1ada4
@ -5,6 +5,7 @@
|
||||
package hooks
|
||||
|
||||
import (
|
||||
"golang.org/x/tools/go/analysis/passes/nilness"
|
||||
"golang.org/x/tools/internal/lsp/source"
|
||||
"honnef.co/go/tools/simple"
|
||||
"honnef.co/go/tools/staticcheck"
|
||||
@ -26,5 +27,10 @@ func updateAnalyzers(options *source.Options) {
|
||||
for _, a := range stylecheck.Analyzers {
|
||||
options.Analyzers[a.Name] = a
|
||||
}
|
||||
// Add the nilness analyzer only for users who have enabled staticcheck.
|
||||
// The assumption here is that a user who has enabled staticcheck will
|
||||
// be fine with gopls using significantly more memory. nilness requires
|
||||
// SSA, which makes it expensive.
|
||||
options.Analyzers[nilness.Analyzer.Name] = nilness.Analyzer
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import (
|
||||
"golang.org/x/tools/go/analysis/passes/loopclosure"
|
||||
"golang.org/x/tools/go/analysis/passes/lostcancel"
|
||||
"golang.org/x/tools/go/analysis/passes/nilfunc"
|
||||
"golang.org/x/tools/go/analysis/passes/nilness"
|
||||
"golang.org/x/tools/go/analysis/passes/printf"
|
||||
"golang.org/x/tools/go/analysis/passes/shift"
|
||||
"golang.org/x/tools/go/analysis/passes/sortslice"
|
||||
@ -488,7 +487,6 @@ func defaultAnalyzers() map[string]*analysis.Analyzer {
|
||||
|
||||
// Non-vet analyzers
|
||||
deepequalerrors.Analyzer.Name: deepequalerrors.Analyzer,
|
||||
nilness.Analyzer.Name: nilness.Analyzer,
|
||||
sortslice.Analyzer.Name: sortslice.Analyzer,
|
||||
testinggoroutine.Analyzer.Name: testinggoroutine.Analyzer,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user