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. //