Strip 'v' prefix from version, to make it consistent for release and snapshot

This commit is contained in:
Deluan 2020-07-21 20:22:23 -04:00
parent 167fca86d0
commit f28e8118dc

View File

@ -1,6 +1,9 @@
package consts package consts
import "fmt" import (
"fmt"
"strings"
)
var ( var (
// This will be set in build time. If not, version will be set to "dev" // This will be set in build time. If not, version will be set to "dev"
@ -11,10 +14,12 @@ var (
// Formats: // Formats:
// dev // dev
// v0.2.0 (5b84188) // v0.2.0 (5b84188)
// v0.3.2-SNAPSHOT (715f552)
// master (9ed35cb) // master (9ed35cb)
func Version() string { func Version() string {
if gitSha == "" { if gitSha == "" {
return "dev" return "dev"
} }
gitTag = strings.TrimPrefix(gitTag, "v")
return fmt.Sprintf("%s (%s)", gitTag, gitSha) return fmt.Sprintf("%s (%s)", gitTag, gitSha)
} }