Skip to content

Commit 4ed61fd

Browse files
committed
chore: domain merge simplification
1 parent 98371c4 commit 4ed61fd

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cmd/cmd_renew.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"errors"
77
"math/rand"
88
"os"
9+
"slices"
910
"time"
1011

1112
"github.com/go-acme/lego/v4/acme/api"
@@ -377,16 +378,12 @@ func addPathToMetadata(meta map[string]string, domain string, certRes *certifica
377378

378379
func merge(prevDomains, nextDomains []string) []string {
379380
for _, next := range nextDomains {
380-
var found bool
381-
for _, prev := range prevDomains {
382-
if prev == next {
383-
found = true
384-
break
385-
}
386-
}
387-
if !found {
388-
prevDomains = append(prevDomains, next)
381+
if slices.Contains(prevDomains, next) {
382+
continue
389383
}
384+
385+
prevDomains = append(prevDomains, next)
390386
}
387+
391388
return prevDomains
392389
}

0 commit comments

Comments
 (0)