Add "rc" as possible release cycle value

"rc" stands for "release candidate", which will trigger the same versioning
display as an actual release (i.e. just report the version, without the
Git hash info).
This commit is contained in:
Sybren A. Stüvel 2023-02-21 11:22:00 +01:00
parent daaadbf2fd
commit 49d8c4e6fd

View File

@ -24,6 +24,7 @@ var ApplicationGitHash = "set-during-build"
// that only supports strings. // that only supports strings.
var ReleaseCycle string = "set-during-build" var ReleaseCycle string = "set-during-build"
const releaseCycleReleaseCandidate = "rc"
const releaseCycleRelease = "release" const releaseCycleRelease = "release"
// FormattedApplicationInfo returns the application name & version as single string. // FormattedApplicationInfo returns the application name & version as single string.
@ -39,9 +40,10 @@ func UserAgent() string {
// ExtendedVersion returns the application version, and includes the Git hash if // ExtendedVersion returns the application version, and includes the Git hash if
// this is not a release version. See `IsReleaseVersion`. // this is not a release version. See `IsReleaseVersion`.
func ExtendedVersion() string { func ExtendedVersion() string {
if ReleaseCycle == releaseCycleRelease { switch ReleaseCycle {
case releaseCycleRelease, releaseCycleReleaseCandidate:
return ApplicationVersion return ApplicationVersion
default:
return fmt.Sprintf("%s-%s", ApplicationVersion, ApplicationGitHash)
} }
return fmt.Sprintf("%s-%s", ApplicationVersion, ApplicationGitHash)
} }