From 9b9633e07a7b3d552d4478601490aaa8ed48ae18 Mon Sep 17 00:00:00 2001 From: Rob Findley Date: Fri, 30 Apr 2021 11:37:24 -0400 Subject: [PATCH] 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 Run-TryBot: Robert Findley Reviewed-by: Heschi Kreinick gopls-CI: kokoro TryBot-Result: Go Bot --- internal/lsp/regtest/regtest.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/lsp/regtest/regtest.go b/internal/lsp/regtest/regtest.go index 35cf3f33cb..c1df26d8aa 100644 --- a/internal/lsp/regtest/regtest.go +++ b/internal/lsp/regtest/regtest.go @@ -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:])