mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-08 10:39:52 +00:00
feat: add & remove default filter(s) to analyze.
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
This commit is contained in:
@@ -65,3 +65,20 @@ func GetParent(client *kubernetes.Client, meta metav1.ObjectMeta) (string, bool)
|
||||
}
|
||||
return meta.Name, false
|
||||
}
|
||||
|
||||
func RemoveDuplicates(slice []string) ([]string, []string) {
|
||||
set := make(map[string]bool)
|
||||
duplicates := []string{}
|
||||
for _, val := range slice {
|
||||
if _, ok := set[val]; !ok {
|
||||
set[val] = true
|
||||
} else {
|
||||
duplicates = append(duplicates, val)
|
||||
}
|
||||
}
|
||||
uniqueSlice := make([]string, 0, len(set))
|
||||
for val := range set {
|
||||
uniqueSlice = append(uniqueSlice, val)
|
||||
}
|
||||
return uniqueSlice, duplicates
|
||||
}
|
||||
|
Reference in New Issue
Block a user