Are you sorted?
Go sort package implements sorting for builtins and user-defined types. It’s flexibility makes sorting a breeze!
Sorting a slice full of Strings as simple as using a simple one line
sort.Strings(sliceOfStrings). Below is an example of sorting a few Strings
Sorting ints are just as quick a simple one line of sort.Ints(sliceofints) will sort all of your integers from smallest to largest.
Go has a built in function that will return true or false based upon if a slice is sorted. Adding to the Integer code above, we can tell if the slice is sorted.
That was a quick article of sorting using Go! If you want to learn about looping in Go check out the previous article Looping in Go