Skip to content

Commit

Permalink
Update version/version.go to match enterprise
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Anderson <[email protected]>
  • Loading branch information
markan committed May 9, 2022
1 parent 4364e44 commit 83ccdcd
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions version/version.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package version

import (
"fmt"
"strings"
)

Expand All @@ -15,6 +16,9 @@ var (
// for tests to work.
Version = "1.12.0"

// https://semver.org/#spec-item-10
VersionMetadata = ""

// A pre-release marker for the version. If this is "" (empty string)
// then it means that it is a final release. Otherwise, this is a pre-release
// such as "dev" (in development), "beta", "rc1", etc.
Expand All @@ -26,13 +30,14 @@ var (
func GetHumanVersion() string {
version := Version
release := VersionPrerelease
metadata := VersionMetadata

if release != "" {
suffix := "-" + release
if !strings.HasSuffix(version, suffix) {
// if we tagged a prerelease version then the release is in the version already
version += suffix
}
version += fmt.Sprintf("-%s", release)
}

if metadata != "" {
version += fmt.Sprintf("+%s", metadata)
}

// Strip off any single quotes added by the git information.
Expand Down

0 comments on commit 83ccdcd

Please sign in to comment.