Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hack update gh releases: replace deprecated semver.Max with semver.Compare #10569

Merged
merged 1 commit into from
Feb 22, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions hack/update/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down