ntfy-alertmanager/functions.go
Thorben Günther 057b2e15f6
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
2023-08-11 13:50:53 +02:00

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
}