Mzack9999 a534b9f06c
Fixing directory walk error check on windows (#1951)
* Fixing directory walk error check on windows

* moving check to helper package

* replacing godirwalk with standard library
2022-05-08 12:22:21 +05:30

40 lines
717 B
Go

package compare
import (
"strings"
)
// StringSlice compares two string slices for equality
func StringSlice(a, b []string) bool {
// If one is nil, the other must also be nil.
if (a == nil) != (b == nil) {
return false
}
if len(a) != len(b) {
return false
}
for i := range a {
if !strings.EqualFold(a[i], b[i]) {
return false
}
}
return true
}
// StringMap compares two string maps for equality
func StringMap(a, b map[string]string) bool {
// If one is nil, the other must also be nil.
if (a == nil) != (b == nil) {
return false
}
if len(a) != len(b) {
return false
}
for k, v := range a {
if w, ok := b[k]; !ok || !strings.EqualFold(v, w) {
return false
}
}
return true
}