Signed-off-by: Lajos Papp <lajos.papp@sequenceiq.com>
| ... | ... |
@@ -12,9 +12,17 @@ func (me Version) compareTo(other Version) int {
|
| 12 | 12 |
meTab = strings.Split(string(me), ".") |
| 13 | 13 |
otherTab = strings.Split(string(other), ".") |
| 14 | 14 |
) |
| 15 |
- for i, s := range meTab {
|
|
| 15 |
+ |
|
| 16 |
+ max := len(meTab) |
|
| 17 |
+ if len(otherTab) > max {
|
|
| 18 |
+ max = len(otherTab) |
|
| 19 |
+ } |
|
| 20 |
+ for i := 0; i < max; i++ {
|
|
| 16 | 21 |
var meInt, otherInt int |
| 17 |
- meInt, _ = strconv.Atoi(s) |
|
| 22 |
+ |
|
| 23 |
+ if len(meTab) > i {
|
|
| 24 |
+ meInt, _ = strconv.Atoi(meTab[i]) |
|
| 25 |
+ } |
|
| 18 | 26 |
if len(otherTab) > i {
|
| 19 | 27 |
otherInt, _ = strconv.Atoi(otherTab[i]) |
| 20 | 28 |
} |
| ... | ... |
@@ -25,9 +33,6 @@ func (me Version) compareTo(other Version) int {
|
| 25 | 25 |
return -1 |
| 26 | 26 |
} |
| 27 | 27 |
} |
| 28 |
- if len(otherTab) > len(meTab) {
|
|
| 29 |
- return -1 |
|
| 30 |
- } |
|
| 31 | 28 |
return 0 |
| 32 | 29 |
} |
| 33 | 30 |
|