mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 09:54:18 +02:00
add dirty to version.commit if there are uncommitted changes
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user