Skip to content

Commit b36df99

Browse files
szuecstroll-os
authored andcommitted
refactor: use slices.Contains instead of handrolled for loop (kubernetes-sigs#5589)
Signed-off-by: Sandor Szuecs <[email protected]>
1 parent 3f9bff4 commit b36df99

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

plan/plan.go

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package plan
1818

1919
import (
2020
"fmt"
21+
"slices"
2122
"strings"
2223

2324
"github.com/google/go-cmp/cmp"
@@ -366,15 +367,8 @@ func normalizeDNSName(dnsName string) string {
366367
}
367368

368369
func IsManagedRecord(record string, managedRecords, excludeRecords []string) bool {
369-
for _, r := range excludeRecords {
370-
if record == r {
371-
return false
372-
}
373-
}
374-
for _, r := range managedRecords {
375-
if record == r {
376-
return true
377-
}
370+
if slices.Contains(excludeRecords, record) {
371+
return false
378372
}
379-
return false
373+
return slices.Contains(managedRecords, record)
380374
}

0 commit comments

Comments
 (0)