π¬
In reply to:
Oh nice indeed.
I went to check the docs and they have an even more intricate example with multiple checks https://pkg.go.dev/cmp#example-Or-Sort
slices.SortFunc(orders, func(a, b Order) int {
return cmp.Or(
strings.Compare(a.Customer, b.Customer),
strings.Compare(a.Product, b.Product),
cmp.Compare(b.Price, a.Price),
)
})