From 74b76ca0dfc74680499ca07dd8bf51ee64edeba2 Mon Sep 17 00:00:00 2001 From: Prajwal Bharadwaj BM Date: Sat, 1 Mar 2025 12:51:11 +0530 Subject: [PATCH] build: improve GoVersion comparison logic Refactor AtLeast method to correctly handle version comparisons by: - Checking major version first - Handling minor version comparisons - Ensuring correct comparison of patch versions --- build.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build.go b/build.go index 34bdebaf8..32eefb7c0 100644 --- a/build.go +++ b/build.go @@ -298,19 +298,21 @@ func (v GoVersion) AtLeast(other GoVersion) bool { return true } + if v.Major > other.Major { + return true + } if v.Major < other.Major { return false } + if v.Minor > other.Minor { + return true + } if v.Minor < other.Minor { return false } - if v.Patch < other.Patch { - return false - } - - return true + return v.Patch >= other.Patch } func (v GoVersion) String() string {