From dd8e9286989c5c43ddba55967bf1eb6767241663 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Mej=C3=ADas=20Rodr=C3=ADguez?= Date: Fri, 9 Aug 2019 01:39:01 -0400 Subject: [PATCH] Update version string building --- common/version.go | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/common/version.go b/common/version.go index 907e55e..ea59ff8 100644 --- a/common/version.go +++ b/common/version.go @@ -21,16 +21,15 @@ var ( ) func BuildVersionString() string { + osArch := runtime.GOOS + "/" + runtime.GOARCH + + if version == "" { + return fmt.Sprintf("%s SNAPSHOT %s", programName, osArch) + } + if commitHash != "" { version += "+" + strings.ToUpper(commitHash) } - osArch := runtime.GOOS + "/" + runtime.GOARCH - - date := buildDate - if date == "" { - date = "unknown" - } - - return fmt.Sprintf("%s %s %s BuildDate: %s", programName, version, osArch, date) + return fmt.Sprintf("%s %s %s BuildDate: %s", programName, version, osArch, buildDate) }