github.com/Cloud-Foundations/Dominator@v0.3.4/lib/verstr/sort.go (about)

     1  package verstr
     2  
     3  import (
     4  	"sort"
     5  )
     6  
     7  type sliceWrapper []string
     8  
     9  func (list sliceWrapper) Len() int {
    10  	return len(list)
    11  }
    12  
    13  func (list sliceWrapper) Less(i, j int) bool {
    14  	return Less(list[i], list[j])
    15  }
    16  
    17  func (list sliceWrapper) Swap(i, j int) {
    18  	list[i], list[j] = list[j], list[i]
    19  }
    20  
    21  func doSort(list []string) {
    22  	sort.Sort(sliceWrapper(list))
    23  }