There are primarily three ways of sorting slices in Go. Early on, we had the verbose but
flexible method of implementing sort.Interface to sort the elements in a slice. Later, Go
1.8 introduced sort.Slice to reduce boilerplate with inline comparison functions. Most
recently, Go 1.21 brought generic sorting via the slices package, which offers a concise
syntax and compile-time type safety.
These days, I mostly use the generic sorting syntax, but I wanted to document all three approaches for posterity.