mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 23:07:44 +00:00
tool/go: don't use the names GOOS/GOARCH in script
The use of GOOS to mean "the compiler's host architecture" ends up overriding whatever GOOS the user passed in, resulting in befuddling errors like "unsupported GOOS/GOARCH pair linux/wasm" when the caller requests js/wasm. Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
fe5558094c
commit
afe19d1d81
18
tool/go
18
tool/go
@ -27,14 +27,14 @@ fi
|
||||
|
||||
# This works for linux and darwin, which is sufficient
|
||||
# (we do not build tailscale-go for other targets).
|
||||
GOOS=$(uname -s | tr A-Z a-z)
|
||||
ARCH="$(uname -m)"
|
||||
if [ "$ARCH" = "aarch64" ]; then
|
||||
host_os=$(uname -s | tr A-Z a-z)
|
||||
host_arch="$(uname -m)"
|
||||
if [ "$host_arch" = "aarch64" ]; then
|
||||
# Go uses the name "arm64".
|
||||
ARCH="arm64"
|
||||
elif [ "$ARCH" = "x86_64" ]; then
|
||||
host_arch="arm64"
|
||||
elif [ "$host_arch" = "x86_64" ]; then
|
||||
# Go uses the name "amd64".
|
||||
ARCH="amd64"
|
||||
host_arch="amd64"
|
||||
fi
|
||||
|
||||
get_cached() {
|
||||
@ -58,7 +58,7 @@ get_cached() {
|
||||
rm -f "$archive.new" "$TOOLCHAIN.extracted"
|
||||
if [ ! -e "$archive" ]; then
|
||||
log "Need to download go '$REV'."
|
||||
curl -f -L -o "$archive.new" "https://github.com/tailscale/go/releases/download/build-${REV}/${GOOS}-${ARCH}.tar.gz"
|
||||
curl -f -L -o "$archive.new" "https://github.com/tailscale/go/releases/download/build-${REV}/${host_os}-${host_arch}.tar.gz"
|
||||
rm -f "$archive"
|
||||
mv "$archive.new" "$archive"
|
||||
fi
|
||||
@ -72,8 +72,8 @@ get_cached() {
|
||||
}
|
||||
|
||||
if [ "${REV}" = "SKIP" ] ||
|
||||
[ "${GOOS}" != "darwin" -a "${GOOS}" != "linux" ] ||
|
||||
[ "${ARCH}" != "amd64" -a "${ARCH}" != "arm64" ]; then
|
||||
[ "${host_os}" != "darwin" -a "${host_os}" != "linux" ] ||
|
||||
[ "${host_arch}" != "amd64" -a "${host_arch}" != "arm64" ]; then
|
||||
# Use whichever go is available
|
||||
exec go "$@"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user