mirror of
https://github.com/weaveworks/scope.git
synced 2026-03-04 10:41:14 +00:00
This caused a dependency chain reaction (sigh):
* All the k8s packages had to be fetched again. This in turn required:
* Pining github.com/docker/docker/pkg/parsers to
0f5c9d301b9b1cca66b3ea0f9dec3b5317d3686d to cirvumvent
https://github.com/kubernetes/kubernetes/issues/18774
* Update github.com/juju/ratelimit
* Make probe/kubernetes/client.go comply with API changes.
29 lines
555 B
Go
29 lines
555 B
Go
package semver
|
|
|
|
import (
|
|
"sort"
|
|
)
|
|
|
|
// Versions represents multiple versions.
|
|
type Versions []Version
|
|
|
|
// Len returns length of version collection
|
|
func (s Versions) Len() int {
|
|
return len(s)
|
|
}
|
|
|
|
// Swap swaps two versions inside the collection by its indices
|
|
func (s Versions) Swap(i, j int) {
|
|
s[i], s[j] = s[j], s[i]
|
|
}
|
|
|
|
// Less checks if version at index i is less than version at index j
|
|
func (s Versions) Less(i, j int) bool {
|
|
return s[i].LT(s[j])
|
|
}
|
|
|
|
// Sort sorts a slice of versions
|
|
func Sort(versions []Version) {
|
|
sort.Sort(Versions(versions))
|
|
}
|