-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
peridot/tools/kernelmanager/packager/v1/v1.go
Lines 44 to 80 in d83f0a2
| // compareVersion takes in two kernel version strings either in the form of "X.Y" or "X.Y.Z" and returns: | |
| // 1 if a > b | |
| // 0 if a == b | |
| // -1 if a < b | |
| func compareVersion(a, b string) int { | |
| // Split version strings into parts | |
| aParts := strings.Split(a, ".") | |
| bParts := strings.Split(b, ".") | |
| // Compare major version | |
| if aParts[0] != bParts[0] { | |
| if aParts[0] > bParts[0] { | |
| return 1 | |
| } | |
| return -1 | |
| } | |
| // Compare minor version | |
| if aParts[1] != bParts[1] { | |
| if aParts[1] > bParts[1] { | |
| return 1 | |
| } | |
| return -1 | |
| } | |
| // If there's a third part, compare it | |
| if len(aParts) == 3 && len(bParts) == 3 { | |
| if aParts[2] != bParts[2] { | |
| if aParts[2] > bParts[2] { | |
| return 1 | |
| } | |
| return -1 | |
| } | |
| } | |
| return 0 | |
| } |
Expected results
6.1 < 6.12
Actual results
6.1 > 6.12
Metadata
Metadata
Assignees
Labels
No labels