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>
diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go
index 045415f..33266d7 100644
--- a/internal/lsp/cache/snapshot.go
+++ b/internal/lsp/cache/snapshot.go
@@ -190,10 +190,14 @@
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 |