3 ms·
Go actually does contain a sort package in the stdlib: https://golang.org/pkg/sort/ https://golang.org/pkg/sort/ with the most ergonomic function being sort.Sli
by cube2222 6y ago
Go actually does contain a sort package in the stdlib: https://golang.org/pkg/sort/ https://golang.org/pkg/sort/ with the most ergonomic function being sort.Slice
As for a complicated for loop instead of the functional equivalent: I too am a fan of functional patterns in this case, but the for loop equivalent in my opinion is just as readable in 99% of cases. A little more verbose, that's all. Matter of taste.