tailscaleroot: panic if tailscale_go build tag but Go toolchain mismatch
Fixes #13527 Change-Id: I05921969a84a303b60d1b3b9227aff9865662831 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
c48cc08de2
commit
1005cbc1e4
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user