functions: Use slices package for sorting

From Go 1.21 release notes[1]:
New slices package for common operations on slices of any element type.
This includes sorting functions that are generally faster and more
ergonomic than the sort package.

[1]: https://go.dev/blog/go1.21
This commit is contained in:
Thorben Günther 2023-08-11 13:50:53 +02:00
parent 164e30b37d
commit 057b2e15f6
No known key found for this signature in database
GPG key ID: 415CD778D8C5AFED

View file

@ -1,6 +1,8 @@
package main
import "sort"
import (
"slices"
)
func sortKeys(m map[string]string) []string {
var s []string
@ -8,6 +10,6 @@ func sortKeys(m map[string]string) []string {
s = append(s, key)
}
sort.Strings(s)
slices.Sort(s)
return s
}