mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-16 11:23:11 -06:00
Do not modify the given slice
This commit is contained in:
parent
2ac7a6c667
commit
b19bcd93e5
|
|
@ -15,11 +15,13 @@ package test
|
||||||
import "sort"
|
import "sort"
|
||||||
|
|
||||||
// StringSliceEqual returns true if the slices have same length & elements.
|
// StringSliceEqual returns true if the slices have same length & elements.
|
||||||
func StringSliceEqual(a []string, b []string) bool {
|
// Does not modify the given slice.
|
||||||
if len(a) != len(b) {
|
func StringSliceEqual(first, second []string) bool {
|
||||||
|
if len(first) != len(second) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a, b := first[:], second[:]
|
||||||
sort.Strings(a)
|
sort.Strings(a)
|
||||||
sort.Strings(b)
|
sort.Strings(b)
|
||||||
for i := range a {
|
for i := range a {
|
||||||
Loading…
Reference in a new issue