isSameArray - check if two arrays are the same
(a, b []string)
| 15 | |
| 16 | // isSameArray - check if two arrays are the same |
| 17 | func isSameArray(a, b []string) bool { |
| 18 | if len(a) != len(b) { |
| 19 | return false |
| 20 | } |
| 21 | |
| 22 | sortedA := make([]string, len(a)) |
| 23 | copy(sortedA, a) |
| 24 | sort.Strings(sortedA) |
| 25 | |
| 26 | sortedB := make([]string, len(b)) |
| 27 | copy(sortedB, b) |
| 28 | sort.Strings(sortedB) |
| 29 | |
| 30 | for i := range sortedA { |
| 31 | if sortedA[i] != sortedB[i] { |
| 32 | return false |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | return true |
| 37 | } |
no outgoing calls
no test coverage detected