(a, b string)
| 216 | } |
| 217 | |
| 218 | func comparePluginVersions(a, b string) (int, bool) { |
| 219 | segmentsA := strings.Split(a, ".") |
| 220 | segmentsB := strings.Split(b, ".") |
| 221 | length := len(segmentsA) |
| 222 | if len(segmentsB) > length { |
| 223 | length = len(segmentsB) |
| 224 | } |
| 225 | for index := 0; index < length; index++ { |
| 226 | numberA, okA := pluginVersionSegment(segmentsA, index) |
| 227 | numberB, okB := pluginVersionSegment(segmentsB, index) |
| 228 | if !okA || !okB { |
| 229 | return 0, false |
| 230 | } |
| 231 | if numberA != numberB { |
| 232 | if numberA < numberB { |
| 233 | return -1, true |
| 234 | } |
| 235 | return 1, true |
| 236 | } |
| 237 | } |
| 238 | return 0, true |
| 239 | } |
| 240 | |
| 241 | func pluginVersionSegment(segments []string, index int) (int64, bool) { |
| 242 | if index >= len(segments) { |
no test coverage detected