From 092357f697aefc45480a378b64b698e063e63da9 Mon Sep 17 00:00:00 2001 From: Heschi Kreinick Date: Tue, 10 Nov 2020 14:35:19 -0500 Subject: [PATCH] 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 Run-TryBot: Heschi Kreinick Reviewed-by: Rebecca Stambler gopls-CI: kokoro --- internal/lsp/cache/snapshot.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/lsp/cache/snapshot.go b/internal/lsp/cache/snapshot.go index 045415f7a8..33266d7dd2 100644 --- a/internal/lsp/cache/snapshot.go +++ b/internal/lsp/cache/snapshot.go @@ -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 |