|
|
@@ -4,7 +4,10 @@
|
|
|
// Package tailscaleroot embeds VERSION.txt into the binary.
|
|
|
package tailscaleroot
|
|
|
|
|
|
-import _ "embed"
|
|
|
+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
|
|
|
@@ -22,3 +25,16 @@ var AlpineDockerTag string
|
|
|
//
|
|
|
//go:embed go.toolchain.rev
|
|
|
var GoToolchainRev string
|
|
|
+
|
|
|
+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
|
|
|
+}
|