From a44cab6b3fd609112e3c66d9fa9ed3e0cf22b3a6 Mon Sep 17 00:00:00 2001 From: nouryxd <66651385+nouryxd@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:43:55 +0200 Subject: [PATCH] only use short commit string --- pkg/common/version.go | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/pkg/common/version.go b/pkg/common/version.go index ebe9229..049ab2d 100644 --- a/pkg/common/version.go +++ b/pkg/common/version.go @@ -7,15 +7,13 @@ package common import ( - "fmt" "runtime/debug" ) // GetVersion returns the current git commit hash. -// If the version is modified the hash ends in "-dirty" func GetVersion() string { var revision string - var modified bool + var short string bi, ok := debug.ReadBuildInfo() if ok { @@ -23,10 +21,7 @@ func GetVersion() string { switch s.Key { case "vcs.revision": revision = s.Value - case "vcs.modified": - if s.Value == "true" { - modified = true - } + short = revision[:7] } } } @@ -35,11 +30,7 @@ func GetVersion() string { return "unavailable" } - if modified { - return fmt.Sprintf("%s-dirty", revision) - } - - return revision + return short } // GetVersion returns the current git commit hash.