From 2189885de921dbb18607f94f326193390aca2beb Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Thu, 21 Nov 2019 20:17:28 -0500 Subject: [PATCH] internal/lsp/cache: disable analysis on dependencies (temporarily) Right now, we request analyses for files in ParseExported mode, which doesn't actually produce any meaningful facts. Disable it until we resolve golang/go#35089, since right now, all this is doing is wasting memory and CPU. Change-Id: I6ffb7bdf6c915159b55753b51289cef4bd937603 Reviewed-on: https://go-review.googlesource.com/c/tools/+/208270 Run-TryBot: Rebecca Stambler TryBot-Result: Gobot Gobot Reviewed-by: Heschi Kreinick --- internal/lsp/cache/analysis.go | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/internal/lsp/cache/analysis.go b/internal/lsp/cache/analysis.go index 5c206fa707..b20dc1ab6f 100644 --- a/internal/lsp/cache/analysis.go +++ b/internal/lsp/cache/analysis.go @@ -104,20 +104,26 @@ func (s *snapshot) actionHandle(ctx context.Context, id packageID, mode source.P } deps = append(deps, reqActionHandle) } - // An analysis that consumes/produces facts - // must run on the package's dependencies too. - if len(a.FactTypes) > 0 { - importIDs := make([]string, 0, len(cph.m.deps)) - for _, importID := range cph.m.deps { - importIDs = append(importIDs, string(importID)) - } - sort.Strings(importIDs) // for determinism - for _, importID := range importIDs { - depActionHandle, err := s.actionHandle(ctx, packageID(importID), source.ParseExported, a) - if err != nil { - return nil, err + + // TODO(golang/go#35089): Re-enable this when we doesn't use ParseExported + // mode for dependencies. In the meantime, disable analysis for dependencies, + // since we don't get anything useful out of it. + if false { + // An analysis that consumes/produces facts + // must run on the package's dependencies too. + if len(a.FactTypes) > 0 { + importIDs := make([]string, 0, len(cph.m.deps)) + for _, importID := range cph.m.deps { + importIDs = append(importIDs, string(importID)) + } + sort.Strings(importIDs) // for determinism + for _, importID := range importIDs { + depActionHandle, err := s.actionHandle(ctx, packageID(importID), source.ParseExported, a) + if err != nil { + return nil, err + } + deps = append(deps, depActionHandle) } - deps = append(deps, depActionHandle) } }