From b19bcd93e596fa7db95c7b05bc0cb93e9d59ae33 Mon Sep 17 00:00:00 2001 From: Anant Prakash Date: Thu, 26 Jul 2018 20:01:37 +0530 Subject: [PATCH] Do not modify the given slice --- .../dendrite/common/test/{strings.go => slice.go} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename src/github.com/matrix-org/dendrite/common/test/{strings.go => slice.go} (84%) diff --git a/src/github.com/matrix-org/dendrite/common/test/strings.go b/src/github.com/matrix-org/dendrite/common/test/slice.go similarity index 84% rename from src/github.com/matrix-org/dendrite/common/test/strings.go rename to src/github.com/matrix-org/dendrite/common/test/slice.go index d72e2b5e1..52d1bb01b 100644 --- a/src/github.com/matrix-org/dendrite/common/test/strings.go +++ b/src/github.com/matrix-org/dendrite/common/test/slice.go @@ -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 {