diff --git a/cmd/tailscale/cli/debug.go b/cmd/tailscale/cli/debug.go index f40859006..e98a9e078 100644 --- a/cmd/tailscale/cli/debug.go +++ b/cmd/tailscale/cli/debug.go @@ -22,6 +22,7 @@ import ( "os" "os/exec" "runtime" + "runtime/debug" "strconv" "strings" "time" @@ -330,9 +331,25 @@ var debugCmd = &ffcli.Command{ return fs })(), }, + { + Name: "go-buildinfo", + ShortUsage: "tailscale debug go-buildinfo", + ShortHelp: "Prints Go's runtime/debug.BuildInfo", + Exec: runGoBuildInfo, + }, }, } +func runGoBuildInfo(ctx context.Context, args []string) error { + bi, ok := debug.ReadBuildInfo() + if !ok { + return errors.New("no Go build info") + } + e := json.NewEncoder(os.Stdout) + e.SetIndent("", "\t") + return e.Encode(bi) +} + var debugArgs struct { file string cpuSec int