version_collection.go 336 B

1234567891011121314151617
  1. package version
  2. // Collection is a type that implements the sort.Interface interface
  3. // so that versions can be sorted.
  4. type Collection []*Version
  5. func (v Collection) Len() int {
  6. return len(v)
  7. }
  8. func (v Collection) Less(i, j int) bool {
  9. return v[i].LessThan(v[j])
  10. }
  11. func (v Collection) Swap(i, j int) {
  12. v[i], v[j] = v[j], v[i]
  13. }