summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2023-10-20 11:39:13 -0700
committerBrad Fitzpatrick <bradfitz@tailscale.com>2023-10-20 12:07:54 -0700
commitbb93ec5d320917178637529a97f9a27610ca6446 (patch)
tree26cc81dc66ecb6b5656f949d6c44afa4d443463a
parent70f9c8a6ed20d91bfff461529a2f948658db1dd0 (diff)
downloadtailscale-bradfitz/gocross_wantver.tar.xz
tailscale-bradfitz/gocross_wantver.zip
tool/gocross: make gocross-wrapper use GOCROSS_WANTVER if set instead of gitbradfitz/gocross_wantver
To run tests in an environment without a git checkout and just the bare files (from git archive) Updates #9841 Change-Id: Ibaf5e230cd8e6af7b25540b773df54d3e1ac25e1 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rwxr-xr-xtool/gocross/gocross-wrapper.sh5
-rw-r--r--tool/gocross/toolchain.go3
2 files changed, 7 insertions, 1 deletions
diff --git a/tool/gocross/gocross-wrapper.sh b/tool/gocross/gocross-wrapper.sh
index 6a9104dd1..f91d7e235 100755
--- a/tool/gocross/gocross-wrapper.sh
+++ b/tool/gocross/gocross-wrapper.sh
@@ -90,7 +90,10 @@ fi
# Anyway, build gocross in a stripped down universe.
gocross_path="gocross"
gocross_ok=0
-wantver="$(git rev-parse HEAD)"
+wantver="${GOCROSS_WANTVER:-}"
+if [[ "$wantver" == "" ]]; then
+ wantver="$(git rev-parse HEAD)"
+fi
if [[ -x "$gocross_path" ]]; then
gotver="$($gocross_path gocross-version 2>/dev/null || echo '')"
if [[ "$gotver" == "$wantver" ]]; then
diff --git a/tool/gocross/toolchain.go b/tool/gocross/toolchain.go
index 5980dff04..203262d0e 100644
--- a/tool/gocross/toolchain.go
+++ b/tool/gocross/toolchain.go
@@ -15,6 +15,9 @@ import (
)
func toolchainRev() (string, error) {
+ if v := os.Getenv("GO_TOOLCHAIN_REV"); v != "" {
+ return v, nil
+ }
// gocross gets built in the root of the repo that has toolchain
// information, so we can use os.Args[0] to locate toolchain info.
//