version: use `go` from the current toolchain to compile in tests.
Signed-off-by: David Anderson <danderson@tailscale.com>pull/2778/head
parent
d1cb7a2639
commit
4ce091cbd8
|
@ -7,6 +7,7 @@ package version
|
||||||
import (
|
import (
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
@ -14,7 +15,8 @@ import (
|
||||||
func TestFindModuleInfo(t *testing.T) {
|
func TestFindModuleInfo(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
name := filepath.Join(dir, "tailscaled-version-test")
|
name := filepath.Join(dir, "tailscaled-version-test")
|
||||||
out, err := exec.Command("go", "build", "-o", name, "tailscale.com/cmd/tailscaled").CombinedOutput()
|
goTool := filepath.Join(runtime.GOROOT(), "bin", "go"+exe())
|
||||||
|
out, err := exec.Command(goTool, "build", "-o", name, "tailscale.com/cmd/tailscaled").CombinedOutput()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to build tailscaled: %v\n%s", err, out)
|
t.Fatalf("failed to build tailscaled: %v\n%s", err, out)
|
||||||
}
|
}
|
||||||
|
@ -27,3 +29,10 @@ func TestFindModuleInfo(t *testing.T) {
|
||||||
t.Errorf("unexpected modinfo contents %q", modinfo)
|
t.Errorf("unexpected modinfo contents %q", modinfo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func exe() string {
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
return ".exe"
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue