diff options
| author | Ian Lance Taylor <iant@golang.org> | 2024-05-22 13:38:40 -0700 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-05-23 01:00:11 +0000 |
| commit | b0b1d42db32a992150dd26681d3bda222e108303 (patch) | |
| tree | f520827bed796e2b0edc4cd91b2ac6dce89c718b /src/index/suffixarray/suffixarray_test.go | |
| parent | 1849ce6a45640ec4a6e63138211eac4276473437 (diff) | |
| download | go-b0b1d42db32a992150dd26681d3bda222e108303.tar.xz | |
all: change from sort functions to slices functions where feasible
Doing this because the slices functions are slightly faster and
slightly easier to use. It also removes one dependency layer.
This CL does not change packages that are used during bootstrap,
as the bootstrap compiler does not have the required slices functions.
It does not change the go/scanner package because the ErrorList
Len, Swap, and Less methods are part of the Go 1 API.
Change-Id: If52899be791c829198e11d2408727720b91ebe8a
Reviewed-on: https://go-review.googlesource.com/c/go/+/587655
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Commit-Queue: Ian Lance Taylor <iant@google.com>
Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/index/suffixarray/suffixarray_test.go')
| -rw-r--r-- | src/index/suffixarray/suffixarray_test.go | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/index/suffixarray/suffixarray_test.go b/src/index/suffixarray/suffixarray_test.go index 44c5041535..da092a737e 100644 --- a/src/index/suffixarray/suffixarray_test.go +++ b/src/index/suffixarray/suffixarray_test.go @@ -12,6 +12,7 @@ import ( "os" "path/filepath" "regexp" + "slices" "sort" "strings" "testing" @@ -141,7 +142,7 @@ func testLookup(t *testing.T, tc *testCase, x *Index, s string, n int) { // we cannot simply check that the res and exp lists are equal // check that each result is in fact a correct match and there are no duplicates - sort.Ints(res) + slices.Sort(res) for i, r := range res { if r < 0 || len(tc.source) <= r { t.Errorf("test %q, lookup %q, result %d (n = %d): index %d out of range [0, %d[", tc.name, s, i, n, r, len(tc.source)) |
