We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 788f112 commit ca72f5fCopy full SHA for ca72f5f
src/internal/testenv/testenv.go
@@ -13,6 +13,7 @@ package testenv
13
import (
14
"os"
15
"os/exec"
16
+ "path/filepath"
17
"runtime"
18
"strings"
19
"testing"
@@ -68,10 +69,17 @@ func MustHaveGoRun(t *testing.T) {
68
69
// If the tool should be available and isn't, GoToolPath calls t.Fatal.
70
func GoToolPath(t *testing.T) string {
71
MustHaveGoBuild(t)
72
+
73
var exeSuffix string
74
if runtime.GOOS == "windows" {
75
exeSuffix = ".exe"
76
}
77
78
+ path := filepath.Join(runtime.GOROOT(), "bin", "go"+exeSuffix)
79
+ if _, err := os.Stat(path); err == nil {
80
+ return path
81
+ }
82
83
goBin, err := exec.LookPath("go" + exeSuffix)
84
if err != nil {
85
t.Fatalf("cannot find go tool: %v", err)
0 commit comments