internal/lsp/cache: disable GOPACKAGESDRIVER

In practice, we only support the go command, and now that we rely on the
private packagesinternal APIs to set -mod and -modfile, GOPACKAGESDRIVER
is actively broken. Forcibly disable it.

Change-Id: I91f8c0d29fada2fe87ad9fdfec6ba8c5504c80cd
Reviewed-on: https://go-review.googlesource.com/c/tools/+/268977
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Heschi Kreinick 2020-11-10 14:35:19 -05:00
parent f6c1dd6914
commit 092357f697
1 changed files with 5 additions and 1 deletions

View File

@ -190,10 +190,14 @@ func (s *snapshot) config(ctx context.Context, inv *gocommand.Invocation) *packa
verboseOutput := s.view.options.VerboseOutput
s.view.optionsMu.Unlock()
// Forcibly disable GOPACKAGESDRIVER. It's incompatible with the
// packagesinternal APIs we use, and we really only support the go commmand
// anyway.
env := append(append([]string{}, inv.Env...), "GOPACKAGESDRIVER=off")
cfg := &packages.Config{
Context: ctx,
Dir: inv.WorkingDir,
Env: inv.Env,
Env: env,
BuildFlags: inv.BuildFlags,
Mode: packages.NeedName |
packages.NeedFiles |