mirror of https://github.com/restic/restic.git
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:
parent
de9a040d27
commit
74b76ca0df
12
build.go
12
build.go
|
@ -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 {
|
||||||
|
|
Loading…
Reference in New Issue