summaryrefslogtreecommitdiff
path: root/bin-src/pem-diff.go
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-09-01 02:14:48 -0600
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-09-01 02:14:48 -0600
commit4dae5b626ff4b64dc719abc46150976c6ba329a9 (patch)
tree0c43b3952863ec6b609a5d4bb656455437d4f666 /bin-src/pem-diff.go
parentcde2c6e7fb4ff62dfb6b3be3b48a1acdb30668a7 (diff)
modernize Go sorting a bitHEADmaster
Diffstat (limited to 'bin-src/pem-diff.go')
-rw-r--r--bin-src/pem-diff.go16
1 files changed, 3 insertions, 13 deletions
diff --git a/bin-src/pem-diff.go b/bin-src/pem-diff.go
index f4bacee..b1c1ac7 100644
--- a/bin-src/pem-diff.go
+++ b/bin-src/pem-diff.go
@@ -7,9 +7,10 @@ import (
"encoding/pem"
"fmt"
"io"
+ "maps"
"net/url"
"os"
- "sort"
+ "slices"
"strings"
"git.lukeshu.com/dashboard/bin-src/util"
@@ -102,17 +103,6 @@ func readCrtSh(filename string, hosts []string) (map[string]Cert, error) {
return ret, nil
}
-func keys(m map[string]Cert) []string {
- ret := make([]string, len(m))
- i := 0
- for k := range m {
- ret[i] = k
- i++
- }
- sort.Strings(ret)
- return ret
-}
-
func main() {
if len(os.Args) != 3 {
_, _ = fmt.Fprintf(os.Stderr, "Usage: %s TLS-file crt.sh-file\n", os.Args[0])
@@ -129,7 +119,7 @@ func mainWithError(filenameTLS string, filenameCrtSh string) error {
if err != nil {
return fmt.Errorf("could load TLS file: %w", err)
}
- hostsTLS := keys(certsTLS)
+ hostsTLS := slices.Sorted(maps.Keys(certsTLS))
certsCrtSh, err := readCrtSh(filenameCrtSh, hostsTLS)
if err != nil {
return fmt.Errorf("could load crt.sh file: %w", err)