github.com/kastenhq/syft@v0.0.0-20230821225854-0710af25cdbe/syft/file/locations.go (about)

     1  package file
     2  
     3  type Locations []Location
     4  
     5  func (l Locations) Len() int {
     6  	return len(l)
     7  }
     8  
     9  func (l Locations) Less(i, j int) bool {
    10  	if l[i].RealPath == l[j].RealPath {
    11  		if l[i].VirtualPath == l[j].VirtualPath {
    12  			return l[i].FileSystemID < l[j].FileSystemID
    13  		}
    14  		return l[i].VirtualPath < l[j].VirtualPath
    15  	}
    16  	return l[i].RealPath < l[j].RealPath
    17  }
    18  
    19  func (l Locations) Swap(i, j int) {
    20  	l[i], l[j] = l[j], l[i]
    21  }