From e1464523be19fe4805796133d58fc7498aefe3aa Mon Sep 17 00:00:00 2001 From: guoguangwu Date: Mon, 10 Jul 2023 11:07:45 +0800 Subject: [PATCH] chore: use copy instead of a loop --- base62_test.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/base62_test.go b/base62_test.go index 36e5fe9..d77e71c 100644 --- a/base62_test.go +++ b/base62_test.go @@ -51,11 +51,8 @@ func TestLexographicOrdering(t *testing.T) { if !sort.StringsAreSorted(unsortedStrings) { sortedStrings := make([]string, len(unsortedStrings)) - for i, s := range unsortedStrings { - sortedStrings[i] = s - } + copy(sortedStrings, unsortedStrings) sort.Strings(sortedStrings) - t.Fatal("base62 encoder does not produce lexographically sorted output.", "expected:", sortedStrings, "actual:", unsortedStrings)