github.com/cloud-foundations/dominator@v0.0.0-20221004181915-6e4fee580046/lib/verstr/api.go (about)

     1  /*
     2  	Package verstr supports comparing and sorting of version strings.
     3  
     4  	Version strings contain substrings of numbers which should be sorted
     5  	numerically rather than lexographically. For example, "file.9.ext" and
     6  	"file.10.ext" sort lexographically such that "file.10.ext" comes first which
     7  	is generally not the desired result. When treated as version strings,
     8  	"file.9.ext" should come first.
     9  */
    10  package verstr
    11  
    12  // Less compares two version strings and returns true if left should be
    13  // considered lesser than right.
    14  func Less(left, right string) bool {
    15  	return less(left, right)
    16  }
    17  
    18  // Sort sorts a slice of strings in-place, treating them as version strings.
    19  func Sort(list []string) {
    20  	doSort(list)
    21  }