internal/lsp/regtest: force GOPACKAGESDRIVER=off

There's no easy way to do this via the LSP, as go/packages reads from
the environment, so simply call os.Setenv.

Fixes golang/go#45866

Change-Id: Iae4e929d47ffef5ffe023ed1886d773a74fd836f
Reviewed-on: https://go-review.googlesource.com/c/tools/+/315649
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Rob Findley 2021-04-30 11:37:24 -04:00 committed by Robert Findley
parent 291330a8d1
commit 9b9633e07a
1 changed files with 3 additions and 0 deletions

View File

@ -87,6 +87,9 @@ func DefaultModes() Mode {
func Main(m *testing.M, hook func(*source.Options)) {
testenv.ExitIfSmallMachine()
// Disable GOPACKAGESDRIVER, as it can cause spurious test failures.
os.Setenv("GOPACKAGESDRIVER", "off")
flag.Parse()
if os.Getenv("_GOPLS_TEST_BINARY_RUN_AS_GOPLS") == "true" {
tool.Main(context.Background(), cmd.New("gopls", "", nil, nil), os.Args[1:])