1
0
mirror of https://github.com/golang/go synced 2024-11-18 11:14:39 -07:00

internal/lsp: remove nilness analyzer

The nilness analyzer requires SSA, which is very expensive to build and
uses a lot of RAM. It also seems to really shoot up memory usage when it
hits certain cases, which is causing a lot of problems for users.
Disable this analysis - we'll leave SSA to staticcheck.

Updates golang/go#36639

Change-Id: I46e67a6fd7828a5fddcd42d1aa00876f17c79e3d
Reviewed-on: https://go-review.googlesource.com/c/tools/+/219203
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rebecca Stambler 2020-02-12 15:31:25 -05:00
parent 6dd6151793
commit 2ee7536ab1

View File

@ -5,7 +5,6 @@
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"
@ -27,10 +26,5 @@ 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
}
}