mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-13 01:43:09 -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"
|
||||
|
||||
// StringSliceEqual returns true if the slices have same length & elements.
|
||||
func StringSliceEqual(a []string, b []string) bool {
|
||||
if len(a) != len(b) {
|
||||
// Does not modify the given slice.
|
||||
func StringSliceEqual(first, second []string) bool {
|
||||
if len(first) != len(second) {
|
||||
return false
|
||||
}
|
||||
|
||||
a, b := first[:], second[:]
|
||||
sort.Strings(a)
|
||||
sort.Strings(b)
|
||||
for i := range a {
|
||||
Loading…
Reference in a new issue