From 715cc1f9de682dc08c63c8f9dd8cb887b5d5ae80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Wei=C3=9Fe?= Date: Fri, 11 Aug 2023 10:45:56 +0200 Subject: [PATCH] Fix version ordering in semver error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Daniel Weiße --- internal/semver/semver.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/semver/semver.go b/internal/semver/semver.go index 9c91dcd7e..206d01a9e 100644 --- a/internal/semver/semver.go +++ b/internal/semver/semver.go @@ -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