From 72dc8d1fd62238da65ac47fb219999f87bef8c32 Mon Sep 17 00:00:00 2001 From: Andrew Kroh Date: Wed, 3 Aug 2022 14:46:56 -0400 Subject: [PATCH] Set GOROOT GOROOT was dropped by https://github.com/actions/setup-go/pull/175. If it is not set then this test fails with: --- FAIL: TestGVMRunUse (5.45s) --- FAIL: TestGVMRunUse/1.7.4_bash (2.68s) use_test.go:54: export GOROOT="/home/runner/.gvm/versions/go1.7.4.linux.amd64" export PATH="/home/runner/.gvm/versions/go1.7.4.linux.amd64/bin:$PATH" use_test.go:79: failed to run go version: exit status 2 go: cannot find GOROOT directory: /usr/local/go --- cmd/gvm/use_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/gvm/use_test.go b/cmd/gvm/use_test.go index a587af5..dca6ff2 100644 --- a/cmd/gvm/use_test.go +++ b/cmd/gvm/use_test.go @@ -72,7 +72,10 @@ func TestGVMRunUse(t *testing.T) { } // Test that GOROOT/bin/go exists and is the correct version. - version, err := exec.Command(filepath.Join(goroot, "bin", "go"), "version").Output() + goVersionCmd := exec.Command(filepath.Join(goroot, "bin", "go"), "version") + goVersionCmd.Env = append(goVersionCmd.Env, "GOROOT="+goroot) + + version, err := goVersionCmd.Output() if err != nil { var exitErr *exec.ExitError if errors.As(err, &exitErr) {