mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-07 18:20:36 +00:00
feat: rework filters
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
This commit is contained in:
@@ -82,3 +82,17 @@ func RemoveDuplicates(slice []string) ([]string, []string) {
|
||||
}
|
||||
return uniqueSlice, duplicates
|
||||
}
|
||||
|
||||
func SliceDiff(source, dest []string) []string {
|
||||
mb := make(map[string]struct{}, len(dest))
|
||||
for _, x := range dest {
|
||||
mb[x] = struct{}{}
|
||||
}
|
||||
var diff []string
|
||||
for _, x := range source {
|
||||
if _, found := mb[x]; !found {
|
||||
diff = append(diff, x)
|
||||
}
|
||||
}
|
||||
return diff
|
||||
}
|
||||
|
Reference in New Issue
Block a user