File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change 5
5
package hooks
6
6
7
7
import (
8
+ "golang.org/x/tools/go/analysis/passes/nilness"
8
9
"golang.org/x/tools/internal/lsp/source"
9
10
"honnef.co/go/tools/simple"
10
11
"honnef.co/go/tools/staticcheck"
@@ -26,5 +27,10 @@ func updateAnalyzers(options *source.Options) {
26
27
for _ , a := range stylecheck .Analyzers {
27
28
options .Analyzers [a .Name ] = a
28
29
}
30
+ // Add the nilness analyzer only for users who have enabled staticcheck.
31
+ // The assumption here is that a user who has enabled staticcheck will
32
+ // be fine with gopls using significantly more memory. nilness requires
33
+ // SSA, which makes it expensive.
34
+ options .Analyzers [nilness .Analyzer .Name ] = nilness .Analyzer
29
35
}
30
36
}
Original file line number Diff line number Diff line change @@ -26,7 +26,6 @@ import (
26
26
"golang.org/x/tools/go/analysis/passes/loopclosure"
27
27
"golang.org/x/tools/go/analysis/passes/lostcancel"
28
28
"golang.org/x/tools/go/analysis/passes/nilfunc"
29
- "golang.org/x/tools/go/analysis/passes/nilness"
30
29
"golang.org/x/tools/go/analysis/passes/printf"
31
30
"golang.org/x/tools/go/analysis/passes/shift"
32
31
"golang.org/x/tools/go/analysis/passes/sortslice"
@@ -493,7 +492,6 @@ var defaultAnalyzers = map[string]*analysis.Analyzer{
493
492
494
493
// Non-vet analyzers
495
494
deepequalerrors .Analyzer .Name : deepequalerrors .Analyzer ,
496
- nilness .Analyzer .Name : nilness .Analyzer ,
497
495
sortslice .Analyzer .Name : sortslice .Analyzer ,
498
496
testinggoroutine .Analyzer .Name : testinggoroutine .Analyzer ,
499
497
}
You can’t perform that action at this time.
0 commit comments