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)