mirror of
https://github.com/argoproj/argo-cd.git
synced 2026-02-20 01:28:45 +01:00
21 lines
364 B
Go
21 lines
364 B
Go
package project
|
|
|
|
func difference(a, b []string) []string {
|
|
return unique(append(a, b...))
|
|
}
|
|
|
|
func unique(slice []string) []string {
|
|
encountered := map[string]int{}
|
|
for _, v := range slice {
|
|
encountered[v] = encountered[v] + 1
|
|
}
|
|
|
|
diff := make([]string, 0)
|
|
for _, v := range slice {
|
|
if encountered[v] == 1 {
|
|
diff = append(diff, v)
|
|
}
|
|
}
|
|
return diff
|
|
}
|