slices package implements sorting for builtins and user-defined types. This guide covers sorting for built-in types.
Sorting Strings
Sorting functions are generic and work for any ordered built-in type. For a list of ordered types, see cmp.Ordered.Sorting Integers
The sameSort function works for integers:
Checking Sort Order
Use theslices package to check if a slice is already in sorted order:
Custom Sorting
Learn how to sort by custom comparison functions