Implement Sort Interface
sort package defines an interface whose name is Interface:
type Interface interface { // Len is the number of elements in the collection. Len() int // Less reports whether the element with // index i should sort before the element with index j. Less(i, j int) bool // Swap swaps the elements with indexes i and j. Swap(i, j int) } For slice, or any other collection types, provided that it implements the Len(), Less and Swap functions, you can use sort.
[Read More]