Files
tailscale/version-embed.go
Brad Fitzpatrick 8f8236feb3 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>
2026-01-27 14:49:56 -08:00

48 lines
1.3 KiB
Go

// Copyright (c) Tailscale Inc & contributors
// SPDX-License-Identifier: BSD-3-Clause
// Package tailscaleroot embeds VERSION.txt into the binary.
package tailscaleroot
import (
_ "embed"
"runtime/debug"
)
// VersionDotTxt is the contents of VERSION.txt. Despite the tempting filename,
// this does not necessarily contain the accurate version number of the build, which
// depends on the branch type and how it was built. To get version information, use
// the version package instead.
//
//go:embed VERSION.txt
var VersionDotTxt string
//go:embed ALPINE.txt
var AlpineDockerTag string
// GoToolchainRev is the git hash from github.com/tailscale/go that this release
// should be built using. It may end in a newline.
//
//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()
if !ok {
return "", false
}
for _, s := range bi.Settings {
if s.Key == "tailscale.toolchain.rev" {
return s.Value, true
}
}
return "", false
}