From 1419183c507ccb8023a7abd9b5a453281959891b Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Mon, 13 Jul 2026 12:53:30 +0200 Subject: [PATCH] add dirty to version.commit if there are uncommitted changes --- cmd/root.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/root.go b/cmd/root.go index db7ec05..f0ca434 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -21,6 +21,7 @@ import ( "fmt" golog "log" "os" + "runtime/debug" "runtime/pprof" "strings" @@ -253,6 +254,12 @@ func Version(conf *cfg.Config) *cli.Command { Usage: "show esctl version information", Action: func(ctx context.Context, cmd *cli.Command) error { + info, _ := debug.ReadBuildInfo() + + if strings.Contains(info.Main.Version, "+dirty") { + cfg.COMMIT += "+dirty" + } + _, err := fmt.Printf(versionFmt, cfg.Version, cfg.BUILD, cfg.BRANCH, cfg.COMMIT, cfg.GOVERSION, cfg.APIVERSION)