Skip to content

Commit

Permalink
Fix version ordering in semver error messages
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Weiße <[email protected]>
  • Loading branch information
daniel-weisse committed Aug 11, 2023
1 parent dcd1c8b commit 715cc1f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/semver/semver.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ func (v Semver) MajorMinorEqual(other Semver) bool {
// It checks if the version of v is greater than the version of other and allows a drift of at most one minor version.
func (v Semver) IsUpgradeTo(other Semver) error {
if v.Compare(other) <= 0 {
return compatibility.NewInvalidUpgradeError(v.String(), other.String(), errors.New("current version newer than or equal to new version"))
return compatibility.NewInvalidUpgradeError(other.String(), v.String(), errors.New("current version newer than or equal to new version"))
}
if v.major != other.major {
return compatibility.NewInvalidUpgradeError(v.String(), other.String(), compatibility.ErrMajorMismatch)
return compatibility.NewInvalidUpgradeError(other.String(), v.String(), compatibility.ErrMajorMismatch)
}

if v.minor-other.minor > 1 {
return compatibility.NewInvalidUpgradeError(v.String(), other.String(), compatibility.ErrMinorDrift)
return compatibility.NewInvalidUpgradeError(other.String(), v.String(), compatibility.ErrMinorDrift)
}

return nil
Expand Down

0 comments on commit 715cc1f

Please sign in to comment.