mirror of
https://github.com/rancher/norman.git
synced 2025-09-25 14:46:57 +00:00
Util method
This commit is contained in:
17
types/set/reconcile.go
Normal file
17
types/set/reconcile.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package set
|
||||||
|
|
||||||
|
func Diff(desired, actual map[string]bool) (toCreate []string, toDelete []string, same []string) {
|
||||||
|
for key := range desired {
|
||||||
|
if actual[key] {
|
||||||
|
same = append(same, key)
|
||||||
|
} else {
|
||||||
|
toCreate = append(toCreate, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for key := range actual {
|
||||||
|
if !desired[key] {
|
||||||
|
toDelete = append(toDelete, key)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
Reference in New Issue
Block a user