list.go 314 B

12345678910111213141516171819
  1. package version
  2. // List is a slice of versions that implements sort.Interface.
  3. type List []*Version
  4. func (list List) Len() int {
  5. return len(list)
  6. }
  7. func (list List) Less(i, j int) bool {
  8. return list[i].Less(list[j])
  9. }
  10. func (list List) Swap(i, j int) {
  11. a := list[i]
  12. b := list[j]
  13. list[i] = b
  14. list[j] = a
  15. }