diff --git a/net/tlsdial/tlsdial_test.go b/net/tlsdial/tlsdial_test.go index 9bfb5b066..99267fb16 100644 --- a/net/tlsdial/tlsdial_test.go +++ b/net/tlsdial/tlsdial_test.go @@ -43,7 +43,7 @@ func TestFallbackRootWorks(t *testing.T) { crtFile := filepath.Join(d, "tlsdial.test.crt") keyFile := filepath.Join(d, "tlsdial.test.key") caFile := filepath.Join(d, "rootCA.pem") - cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), + cmd := exec.Command("go", "run", "filippo.io/mkcert", "--cert-file="+crtFile, "--key-file="+keyFile, diff --git a/tstest/archtest/qemu_test.go b/tstest/archtest/qemu_test.go index 15508fb6d..89a2f78f2 100644 --- a/tstest/archtest/qemu_test.go +++ b/tstest/archtest/qemu_test.go @@ -11,8 +11,6 @@ "fmt" "os" "os/exec" - "path/filepath" - "runtime" "strings" "testing" @@ -53,7 +51,7 @@ type Arch struct { } t.Logf("using %v", look) } - cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), + cmd := exec.Command("go", "test", "--exec="+execVia, "-v", diff --git a/tstest/iosdeps/iosdeps_test.go b/tstest/iosdeps/iosdeps_test.go index 50719c3b2..6d16e6a15 100644 --- a/tstest/iosdeps/iosdeps_test.go +++ b/tstest/iosdeps/iosdeps_test.go @@ -13,13 +13,11 @@ "encoding/json" "os" "os/exec" - "path/filepath" - "runtime" "testing" ) func TestDeps(t *testing.T) { - cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "list", "-json", ".") + cmd := exec.Command("go", "list", "-json", ".") cmd.Env = append(os.Environ(), "GOOS=ios", "GOARCH=arm64") out, err := cmd.Output() if err != nil { diff --git a/tstest/jsdeps/jsdeps_test.go b/tstest/jsdeps/jsdeps_test.go index f89146011..200a13c20 100644 --- a/tstest/jsdeps/jsdeps_test.go +++ b/tstest/jsdeps/jsdeps_test.go @@ -13,13 +13,11 @@ "encoding/json" "os" "os/exec" - "path/filepath" - "runtime" "testing" ) func TestDeps(t *testing.T) { - cmd := exec.Command(filepath.Join(runtime.GOROOT(), "bin", "go"), "list", "-json", ".") + cmd := exec.Command("go", "list", "-json", ".") cmd.Env = append(os.Environ(), "GOOS=js", "GOARCH=wasm") out, err := cmd.Output() if err != nil { diff --git a/version/modinfo_test.go b/version/modinfo_test.go index 2bf46f6fe..3a8725abd 100644 --- a/version/modinfo_test.go +++ b/version/modinfo_test.go @@ -23,8 +23,7 @@ func TestFindModuleInfo(t *testing.T) { dir := t.TempDir() name := filepath.Join(dir, "tailscaled-version-test") - goTool := filepath.Join(runtime.GOROOT(), "bin", "go"+exe()) - out, err := exec.Command(goTool, "build", "-o", name, "tailscale.com/cmd/tailscaled").CombinedOutput() + out, err := exec.Command("go", "build", "-o", name, "tailscale.com/cmd/tailscaled").CombinedOutput() if err != nil { t.Fatalf("failed to build tailscaled: %v\n%s", err, out) }