From 49d8c4e6fd39e0eb6b35f0162ebbee4679e68676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 21 Feb 2023 11:22:00 +0100 Subject: [PATCH] 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). --- internal/appinfo/appinfo.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/appinfo/appinfo.go b/internal/appinfo/appinfo.go index 7b08b7f5..218ea013 100644 --- a/internal/appinfo/appinfo.go +++ b/internal/appinfo/appinfo.go @@ -24,6 +24,7 @@ var ApplicationGitHash = "set-during-build" // that only supports strings. var ReleaseCycle string = "set-during-build" +const releaseCycleReleaseCandidate = "rc" const releaseCycleRelease = "release" // 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 // this is not a release version. See `IsReleaseVersion`. func ExtendedVersion() string { - if ReleaseCycle == releaseCycleRelease { + switch ReleaseCycle { + case releaseCycleRelease, releaseCycleReleaseCandidate: return ApplicationVersion + default: + return fmt.Sprintf("%s-%s", ApplicationVersion, ApplicationGitHash) } - - return fmt.Sprintf("%s-%s", ApplicationVersion, ApplicationGitHash) }