Examples using... sort.Sort()

Recent
Package sort provides primitives for sorting slices and user-defined collections.
ExampleMultiKeys demonstrates a technique for sorting a struct type using different sets of multiple fields in the comparison. We chain together "Less" functions, each of which compares a single field.
ExampleSortKeys demonstrates a technique for sorting a struct type using programmable sort criteria.
Package sort provides primitives for sorting slices and user-defined collections.
Reverse returns the reverse order for data.
Sometimes we’ll want to sort a collection by something other than its natural order. For example, suppose we wanted to sort strings by their length instead of alphabetically. Here’s an example of custom sorts in Go.