mirror of
https://codeberg.org/scip/esctl.git
synced 2026-08-24 13:54:17 +02:00
add dirty to version.commit if there are uncommitted changes
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
golog "log"
|
golog "log"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime/debug"
|
||||||
"runtime/pprof"
|
"runtime/pprof"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@@ -253,6 +254,12 @@ func Version(conf *cfg.Config) *cli.Command {
|
|||||||
Usage: "show esctl version information",
|
Usage: "show esctl version information",
|
||||||
|
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
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,
|
_, err := fmt.Printf(versionFmt,
|
||||||
cfg.Version, cfg.BUILD, cfg.BRANCH, cfg.COMMIT, cfg.GOVERSION, cfg.APIVERSION)
|
cfg.Version, cfg.BUILD, cfg.BRANCH, cfg.COMMIT, cfg.GOVERSION, cfg.APIVERSION)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user