From 057b2e15f6b024c1771a75327dc96de70da39499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorben=20G=C3=BCnther?= Date: Fri, 11 Aug 2023 13:50:53 +0200 Subject: [PATCH] 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 --- functions.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/functions.go b/functions.go index 2c6c291..abb6d43 100644 --- a/functions.go +++ b/functions.go @@ -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 } -- 2.44.0