MCPcopy Create free account
hub / github.com/zalando/postgres-operator / IsEqualIgnoreOrder

Function IsEqualIgnoreOrder

pkg/util/util.go:141–153  ·  view source on GitHub ↗

Compare two string slices while ignoring the order of elements

(a, b []string)

Source from the content-addressed store, hash-verified

139
140// Compare two string slices while ignoring the order of elements
141func IsEqualIgnoreOrder(a, b []string) bool {
142 if len(a) != len(b) {
143 return false
144 }
145 a_copy := make([]string, len(a))
146 b_copy := make([]string, len(b))
147 copy(a_copy, a)
148 copy(b_copy, b)
149 sort.Strings(a_copy)
150 sort.Strings(b_copy)
151
152 return reflect.DeepEqual(a_copy, b_copy)
153}
154
155// Iterate through slice and remove certain string, then return cleaned slice
156func RemoveString(slice []string, s string) (result []string) {

Callers 9

TestGetAdditionalTeamsFunction · 0.92
TestGatherApplicationIdsFunction · 0.92
TestAdditionalVolumeFunction · 0.92
compareServicesMethod · 0.92
TestIsEqualIgnoreOrderFunction · 0.85
TestRemoveStringFunction · 0.85

Calls

no outgoing calls

Tested by 8

TestGetAdditionalTeamsFunction · 0.74
TestGatherApplicationIdsFunction · 0.74
TestAdditionalVolumeFunction · 0.74
TestIsEqualIgnoreOrderFunction · 0.68
TestRemoveStringFunction · 0.68