Skip to content

Eric Liu's Learning Journal

Smarter every day.

Tag: sort

Sorting a slice in Go easily

1. The slice Package If your Go package is anything newer than 1.21, and the items in the slice are of the cmp.Ordered type, you should definitely use the slice.Sort() function. It only works if you intend to sort it in place and in ascending order, though. So if we want to sort something in… Continue reading Sorting a slice in Go easily

Published 15 Oct 2026
Categorized as Software Engineering Tagged go, slice, sort
Eric Liu's Learning Journal
Proudly powered by WordPress.