summaryrefslogtreecommitdiff
path: root/bin-src/pem-diff.go
diff options
context:
space:
mode:
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)