summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@tailscale.com>2026-01-27 14:44:32 -0800
committerBrad Fitzpatrick <brad@danga.com>2026-01-27 14:49:56 -0800
commit8f8236feb308f1290b1f458316cfb4828e0b54d1 (patch)
tree299a374a5764e4bcb12fb85c167e7c21ecefb494
parenta374cc344e48067a64cacf5bebd49fbe99596688 (diff)
downloadtailscale-8f8236feb308f1290b1f458316cfb4828e0b54d1.tar.xz
tailscale-8f8236feb308f1290b1f458316cfb4828e0b54d1.zip
cmd/printdep: add --next flag to use rc Go build hash instead
Updates tailscale/corp#36382 Change-Id: Ib7474b0aab901e98f0fe22761e26fd181650743c Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
-rw-r--r--assert_ts_toolchain_match.go3
-rw-r--r--cmd/printdep/printdep.go9
-rw-r--r--version-embed.go6
3 files changed, 16 insertions, 2 deletions
diff --git a/assert_ts_toolchain_match.go b/assert_ts_toolchain_match.go
index f0760ec03..901dbb8ec 100644
--- a/assert_ts_toolchain_match.go
+++ b/assert_ts_toolchain_match.go
@@ -17,6 +17,9 @@ func init() {
panic("binary built with tailscale_go build tag but failed to read build info or find tailscale.toolchain.rev in build info")
}
want := strings.TrimSpace(GoToolchainRev)
+ if os.Getenv("TS_GO_NEXT") == "1" {
+ want = strings.TrimSpace(GoToolchainNextRev)
+ }
if tsRev != want {
if os.Getenv("TS_PERMIT_TOOLCHAIN_MISMATCH") == "1" {
fmt.Fprintf(os.Stderr, "tailscale.toolchain.rev = %q, want %q; but ignoring due to TS_PERMIT_TOOLCHAIN_MISMATCH=1\n", tsRev, want)
diff --git a/cmd/printdep/printdep.go b/cmd/printdep/printdep.go
index c4ba5b79a..f5aeab7a5 100644
--- a/cmd/printdep/printdep.go
+++ b/cmd/printdep/printdep.go
@@ -19,6 +19,7 @@ var (
goToolchain = flag.Bool("go", false, "print the supported Go toolchain git hash (a github.com/tailscale/go commit)")
goToolchainURL = flag.Bool("go-url", false, "print the URL to the tarball of the Tailscale Go toolchain")
alpine = flag.Bool("alpine", false, "print the tag of alpine docker image")
+ next = flag.Bool("next", false, "if set, modifies --go or --go-url to use the upcoming/unreleased/rc Go release version instead")
)
func main() {
@@ -27,8 +28,12 @@ func main() {
fmt.Println(strings.TrimSpace(ts.AlpineDockerTag))
return
}
+ goRev := strings.TrimSpace(ts.GoToolchainRev)
+ if *next {
+ goRev = strings.TrimSpace(ts.GoToolchainNextRev)
+ }
if *goToolchain {
- fmt.Println(strings.TrimSpace(ts.GoToolchainRev))
+ fmt.Println(goRev)
}
if *goToolchainURL {
switch runtime.GOOS {
@@ -36,6 +41,6 @@ func main() {
default:
log.Fatalf("unsupported GOOS %q", runtime.GOOS)
}
- fmt.Printf("https://github.com/tailscale/go/releases/download/build-%s/%s-%s.tar.gz\n", strings.TrimSpace(ts.GoToolchainRev), runtime.GOOS, runtime.GOARCH)
+ fmt.Printf("https://github.com/tailscale/go/releases/download/build-%s/%s-%s.tar.gz\n", goRev, runtime.GOOS, runtime.GOARCH)
}
}
diff --git a/version-embed.go b/version-embed.go
index 9f48d1384..c368186ab 100644
--- a/version-embed.go
+++ b/version-embed.go
@@ -26,6 +26,12 @@ var AlpineDockerTag string
//go:embed go.toolchain.rev
var GoToolchainRev string
+// GoToolchainNextRev is like GoToolchainRev, but when using the
+// "go.toolchain.next.rev" when TS_GO_NEXT=1 is set in the environment.
+//
+//go:embed go.toolchain.next.rev
+var GoToolchainNextRev string
+
//lint:ignore U1000 used by tests + assert_ts_toolchain_match.go w/ right build tags
func tailscaleToolchainRev() (gitHash string, ok bool) {
bi, ok := debug.ReadBuildInfo()