Let’s break down why you might want to use the standard Go packages
slices,
maps, and
cmp: how they express intent instead of “manual”
for loops, simplify common operations (cloning, sorting, deleting a range, comparing, copying), how they relate to generics (signatures like
S ~[]E and
M ~map[K]V), and how to build stable output on top of a
map via
maps.Keys +
slices.SortFunc +
cmp.Compare. At the end: typical mistakes and how to avoid them.