gopls/internal/lsp/source: enable nilness Analyzer in gopls
This change enables the nilness Analyser in gopls, which
was previously disabled due to the high asymptotic cost
of SSA construction in the buildssa Analyzer. That problem
has since been fixed by a series of changes to go/ssa
to avoid the need to call CreatePackage for indirect
dependencies.
There is still work to do to reduce the cost of SSA-based
analyzers that use facts (not that we have any today),
as these must be run on the entire workspace, and the
cost of "deep" fact encoding is a hotspot; see CL 513375.
There is also still work to do to port the changes to
go/ssa and buildssa into ir and buildir, the forks of
these packages used by honnef.co/staticcheck. It does
use facts.
Still, progress.
Plus a test.
Change-Id: I61bb045752a53ef19ae4651deee25c6d948ce2fc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/538802
Auto-Submit: Alan Donovan <adonovan@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
diff --git a/go/analysis/validate.go b/go/analysis/validate.go
index 9da5692..4f2c404 100644
--- a/go/analysis/validate.go
+++ b/go/analysis/validate.go
@@ -19,6 +19,8 @@
// that the Requires graph is acyclic;
// that analyzer fact types are unique;
// that each fact type is a pointer.
+//
+// Analyzer names need not be unique, though this may be confusing.
func Validate(analyzers []*Analyzer) error {
// Map each fact type to its sole generating analyzer.
factTypes := make(map[reflect.Type]*Analyzer)