From f80c8c9dc502b26717d117a2097fad6356af624f Mon Sep 17 00:00:00 2001 From: Predrag Rogic Date: Mon, 22 Feb 2021 17:22:13 +0000 Subject: [PATCH] update.GHReleases: replace deprecated semver.Max with semver.Compare --- hack/update/github.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hack/update/github.go b/hack/update/github.go index 298ee866eb1c..7de188f6dfa5 100644 --- a/hack/update/github.go +++ b/hack/update/github.go @@ -228,9 +228,13 @@ func GHReleases(ctx context.Context, owner, repo string) (stable, latest string, // check if ver version is release (ie, 'v1.19.2') or pre-release (ie, 'v1.19.3-rc.0' or 'v1.19.0-beta.2') prerls := semver.Prerelease(ver) if prerls == "" { - stable = semver.Max(ver, stable) + if semver.Compare(ver, stable) == 1 { + stable = ver + } } else if strings.HasPrefix(prerls, "-rc") || strings.HasPrefix(prerls, "-beta") { - latest = semver.Max(ver, latest) + if semver.Compare(ver, latest) == 1 { + latest = ver + } } // make sure that latest >= stable if semver.Compare(latest, stable) == -1 {