~xenrox/ntfy-alertmanager

057b2e15f6b024c1771a75327dc96de70da39499 — Thorben Günther 8 months ago 164e30b
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
1 files changed, 4 insertions(+), 2 deletions(-)

M functions.go
M functions.go => functions.go +4 -2
@@ 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
}