diff --git a/util/version/version.go b/util/version/version.go index f3ca66289a1d..a0d4773287ca 100644 --- a/util/version/version.go +++ b/util/version/version.go @@ -213,8 +213,10 @@ func WithoutPreReleases() CompareOption { // Example: using the WithBuildTags() option modifies the compare logic to also // consider build tags when comparing versions. func Compare(a, b semver.Version, options ...CompareOption) int { - a.Pre = nil - b.Pre = nil + if c. withoutPreReleases { + a.Pre = nil + b.Pre = nil + } c := &comparer{} for _, o := range options {