Skip to content

Commit 817c7bc

Browse files
findleyrgopherbot
authored andcommitted
gopls/internal/test/integration/workspace: fix TestStdWorkspace
When finding GOROOT for TestStdWorkspace, set GOTOOLCHAIN=local to avoid toolchain upgrades due to the gopls go.mod file. Fixes golang/go#70187 Change-Id: I151b4f5a39e6f71a6d4df0742a9d5a77060285e5 Reviewed-on: https://go-review.googlesource.com/c/tools/+/625116 Auto-Submit: Robert Findley <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Alan Donovan <[email protected]>
1 parent e36459f commit 817c7bc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gopls/internal/test/integration/workspace/std_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package workspace
66

77
import (
8+
"os"
89
"os/exec"
910
"path/filepath"
1011
"runtime"
@@ -36,7 +37,12 @@ func TestStdWorkspace(t *testing.T) {
3637

3738
// Query GOROOT. This is slightly more precise than e.g. runtime.GOROOT, as
3839
// it queries the go command in the environment.
39-
goroot, err := exec.Command("go", "env", "GOROOT").Output()
40+
cmd := exec.Command("go", "env", "GOROOT")
41+
// Run with GOTOOLCHAIN=local so as to not be affected by toolchain upgrades
42+
// in the current directory (which is affected by gopls' go.mod file).
43+
// This was golang/go#70187
44+
cmd.Env = append(os.Environ(), "GOTOOLCHAIN=local")
45+
goroot, err := cmd.Output()
4046
if err != nil {
4147
t.Fatal(err)
4248
}

0 commit comments

Comments
 (0)