cmd/tailscale/cli: add 'debug go-buildinfo' subcommand

To dump runtime/debug.BuildInfo.

Updates #1866

Change-Id: I8810390858a03b7649f9b22ef3ab910d423388da
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
pull/13356/head
Brad Fitzpatrick 4 months ago committed by Brad Fitzpatrick
parent 345876da33
commit e865a0e2b0

@ -22,6 +22,7 @@ import (
"os" "os"
"os/exec" "os/exec"
"runtime" "runtime"
"runtime/debug"
"strconv" "strconv"
"strings" "strings"
"time" "time"
@ -330,9 +331,25 @@ var debugCmd = &ffcli.Command{
return fs 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 { var debugArgs struct {
file string file string
cpuSec int cpuSec int

Loading…
Cancel
Save