summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2026-01-26 17:21:08 -0800
committerBrad Fitzpatrick <brad@danga.com>2026-01-27 14:07:35 -0800
commita374cc344e48067a64cacf5bebd49fbe99596688 (patch)
tree51c7febd3afbdf48309fcd3a9761d28638031a40
parentaac12ba799f1af9021cac5dfbdcc0e4df4601626 (diff)
downloadtailscale-a374cc344e48067a64cacf5bebd49fbe99596688.tar.xz
tailscale-a374cc344e48067a64cacf5bebd49fbe99596688.zip
tool/gocross, pull-toolchain.sh: support a "next" Go toolchain
When TS_GO_NEXT=1 is set, update/use the go.toolchain.next.{branch,rev} files instead. This lets us do test deploys of Go release candidates on some backends, without affecting all backends. Updates tailscale/corp#36382 Change-Id: I00dbde87b219b720be5ea142325c4711f101a364 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rw-r--r--go.toolchain.next.branch1
-rw-r--r--go.toolchain.next.rev1
-rwxr-xr-xpull-toolchain.sh27
-rwxr-xr-xtool/gocross/gocross-wrapper.sh12
4 files changed, 31 insertions, 10 deletions
diff --git a/go.toolchain.next.branch b/go.toolchain.next.branch
new file mode 100644
index 000000000..6022b9559
--- /dev/null
+++ b/go.toolchain.next.branch
@@ -0,0 +1 @@
+tailscale.go1.26
diff --git a/go.toolchain.next.rev b/go.toolchain.next.rev
new file mode 100644
index 000000000..ee8816b6f
--- /dev/null
+++ b/go.toolchain.next.rev
@@ -0,0 +1 @@
+07d023ba9bb6d17a84b492f1524fabfa69a31bda
diff --git a/pull-toolchain.sh b/pull-toolchain.sh
index eb8febf6b..b10e3cd68 100755
--- a/pull-toolchain.sh
+++ b/pull-toolchain.sh
@@ -1,20 +1,33 @@
#!/bin/sh
# Retrieve the latest Go toolchain.
+# Set TS_GO_NEXT=1 to update go.toolchain.next.rev instead.
#
set -eu
cd "$(dirname "$0")"
-read -r go_branch <go.toolchain.branch
+if [ "${TS_GO_NEXT:-}" = "1" ]; then
+ go_toolchain_branch_file="go.toolchain.next.branch"
+ go_toolchain_rev_file="go.toolchain.next.rev"
+else
+ go_toolchain_branch_file="go.toolchain.branch"
+ go_toolchain_rev_file="go.toolchain.rev"
+fi
+
+read -r go_branch <"$go_toolchain_branch_file"
upstream=$(git ls-remote https://github.com/tailscale/go "$go_branch" | awk '{print $1}')
-current=$(cat go.toolchain.rev)
+current=$(cat "$go_toolchain_rev_file")
if [ "$upstream" != "$current" ]; then
- echo "$upstream" >go.toolchain.rev
+ echo "$upstream" >"$go_toolchain_rev_file"
fi
-./tool/go version 2>/dev/null | awk '{print $3}' | sed 's/^go//' > go.toolchain.version
-
-./update-flake.sh
+# Only update go.toolchain.version and go.toolchain.rev.sri for the main toolchain,
+# skipping it if TS_GO_NEXT=1. Those two files are only used by Nix, and as of 2026-01-26
+# don't yet support TS_GO_NEXT=1 with flake.nix or in our corp CI.
+if [ "${TS_GO_NEXT:-}" != "1" ]; then
+ ./tool/go version 2>/dev/null | awk '{print $3}' | sed 's/^go//' > go.toolchain.version
+ ./update-flake.sh
+fi
-if [ -n "$(git diff-index --name-only HEAD -- go.toolchain.rev go.toolchain.rev.sri go.toolchain.version)" ]; then
+if [ -n "$(git diff-index --name-only HEAD -- "$go_toolchain_rev_file" go.toolchain.rev.sri go.toolchain.version)" ]; then
echo "pull-toolchain.sh: changes imported. Use git commit to make them permanent." >&2
fi
diff --git a/tool/gocross/gocross-wrapper.sh b/tool/gocross/gocross-wrapper.sh
index 352d639b7..05a35ba42 100755
--- a/tool/gocross/gocross-wrapper.sh
+++ b/tool/gocross/gocross-wrapper.sh
@@ -4,7 +4,7 @@
#
# gocross-wrapper.sh is a wrapper that can be aliased to 'go', which
# transparently runs the version of github.com/tailscale/go as specified repo's
-# go.toolchain.rev file.
+# go.toolchain.rev file (or go.toolchain.next.rev if TS_GO_NEXT=1).
#
# It also conditionally (if TS_USE_GOCROSS=1) builds gocross and uses it as a go
# wrapper to inject certain go flags.
@@ -21,6 +21,12 @@ if [[ "${OSTYPE:-}" == "cygwin" || "${OSTYPE:-}" == "msys" ]]; then
exit
fi
+if [[ "${TS_GO_NEXT:-}" == "1" ]]; then
+ go_toolchain_rev_file="go.toolchain.next.rev"
+else
+ go_toolchain_rev_file="go.toolchain.rev"
+fi
+
# Locate a bootstrap toolchain and (re)build gocross if necessary. We run all of
# this in a subshell because posix shell semantics make it very easy to
# accidentally mutate the input environment that will get passed to gocross at
@@ -45,7 +51,7 @@ cd "$repo_root"
# https://github.com/tailscale/go release artifact to download.
toolchain=""
-read -r REV <go.toolchain.rev
+read -r REV <"$go_toolchain_rev_file"
case "$REV" in
/*)
toolchain="$REV"
@@ -148,7 +154,7 @@ unset GOROOT
# gocross is opt-in as of 2025-06-16. See tailscale/corp#26717
# and comment above in this file.
if [ "${TS_USE_GOCROSS:-}" != "1" ]; then
- read -r REV <"${repo_root}/go.toolchain.rev"
+ read -r REV <"${repo_root}/$go_toolchain_rev_file"
case "$REV" in
/*)
toolchain="$REV"