Skip to content

Commit f2cba91

Browse files
committed
updated difference function with comment to use a set
1 parent c8bd575 commit f2cba91

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tools/azure-npm-to-cilium-validator/azure-npm-to-cilium-validator.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,16 @@ func checkServiceTargetPortMatchPolicyPorts(servicePorts *[]corev1.ServicePort,
300300
}
301301

302302
func difference(slice1, slice2, slice3 *[]string) []string {
303-
m := make(map[string]bool)
303+
m := make(map[string]struct{})
304304
for _, s := range *slice2 {
305-
m[s] = true
305+
m[s] = struct{}{}
306306
}
307307
for _, s := range *slice3 {
308-
m[s] = true
308+
m[s] = struct{}{}
309309
}
310310
var diff []string
311311
for _, s := range *slice1 {
312-
if !m[s] {
312+
if _, ok := m[s]; !ok {
313313
diff = append(diff, s)
314314
}
315315
}

0 commit comments

Comments
 (0)