057b2e15f6
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
15 lines
173 B
Go
15 lines
173 B
Go
package main
|
|
|
|
import (
|
|
"slices"
|
|
)
|
|
|
|
func sortKeys(m map[string]string) []string {
|
|
var s []string
|
|
for key := range m {
|
|
s = append(s, key)
|
|
}
|
|
|
|
slices.Sort(s)
|
|
return s
|
|
}
|