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
This commit is contained in:
Prajwal Bharadwaj BM 2025-03-01 12:51:11 +05:30
parent de9a040d27
commit 74b76ca0df
1 changed files with 7 additions and 5 deletions

View File

@ -298,19 +298,21 @@ func (v GoVersion) AtLeast(other GoVersion) bool {
return true return true
} }
if v.Major > other.Major {
return true
}
if v.Major < other.Major { if v.Major < other.Major {
return false return false
} }
if v.Minor > other.Minor {
return true
}
if v.Minor < other.Minor { if v.Minor < other.Minor {
return false return false
} }
if v.Patch < other.Patch { return v.Patch >= other.Patch
return false
}
return true
} }
func (v GoVersion) String() string { func (v GoVersion) String() string {