github.com/dmmcquay/sia@v1.3.1-0.20180712220038-9f8d535311b9/modules/renter/hostdb/hosttree/sort.go (about) 1 package hosttree 2 3 type byWeight []hostEntry 4 5 func (he byWeight) Len() int { return len(he) } 6 func (he byWeight) Less(i, j int) bool { return he[i].weight.Cmp(he[j].weight) < 0 } 7 func (he byWeight) Swap(i, j int) { he[i], he[j] = he[j], he[i] }