aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api/main_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2024-05-21 21:07:32 -0700
committerGopher Robot <gobot@golang.org>2024-11-18 19:38:28 +0000
commitbb2a5f0556fd6bb4dbbce5eef2d6317d20796ade (patch)
tree74478d496a849532e5095877b2e098036c2921e5 /src/cmd/api/main_test.go
parent80344887818a2321296ce7fa71cca8ca2520611d (diff)
downloadgo-bb2a5f0556fd6bb4dbbce5eef2d6317d20796ade.tar.xz
cmd: change from sort functions to slices functions
Doing this because the slices functions are slightly faster and slightly easier to use. It also removes one dependency layer. We did this outside of bootstrap tools in CL 587655. Now that the bootstrap compiler is 1.22, we can do this in more code. Change-Id: I9ed2dd473758cacd14f76a0639368523ccdff72f Reviewed-on: https://go-review.googlesource.com/c/go/+/626038 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Diffstat (limited to 'src/cmd/api/main_test.go')
-rw-r--r--src/cmd/api/main_test.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/cmd/api/main_test.go b/src/cmd/api/main_test.go
index 10dbabb9b8..a0820c2274 100644
--- a/src/cmd/api/main_test.go
+++ b/src/cmd/api/main_test.go
@@ -25,7 +25,7 @@ import (
"path/filepath"
"regexp"
"runtime"
- "sort"
+ "slices"
"strconv"
"strings"
"sync"
@@ -232,8 +232,8 @@ func compareAPI(w io.Writer, features, required, exception []string) (ok bool) {
featureSet := set(features)
exceptionSet := set(exception)
- sort.Strings(features)
- sort.Strings(required)
+ slices.Sort(features)
+ slices.Sort(required)
take := func(sl *[]string) string {
s := (*sl)[0]
@@ -378,7 +378,7 @@ func (w *Walker) Features() (fs []string) {
for f := range w.features {
fs = append(fs, f)
}
- sort.Strings(fs)
+ slices.Sort(fs)
return
}
@@ -431,7 +431,7 @@ func tagKey(dir string, context *build.Context, tags []string) string {
// an indirect imported package. See https://github.com/golang/go/issues/21181
// for more detail.
tags = append(tags, context.GOOS, context.GOARCH)
- sort.Strings(tags)
+ slices.Sort(tags)
for _, tag := range tags {
if ctags[tag] {
@@ -535,7 +535,7 @@ func (w *Walker) loadImports() {
}
}
- sort.Strings(stdPackages)
+ slices.Sort(stdPackages)
imports = listImports{
stdPackages: stdPackages,
importMap: importMap,
@@ -717,7 +717,7 @@ func sortedMethodNames(typ *types.Interface) []string {
for i := range list {
list[i] = typ.Method(i).Name()
}
- sort.Strings(list)
+ slices.Sort(list)
return list
}
@@ -747,7 +747,7 @@ func (w *Walker) sortedEmbeddeds(typ *types.Interface) []string {
list = append(list, buf.String())
}
}
- sort.Strings(list)
+ slices.Sort(list)
return list
}
@@ -1083,7 +1083,7 @@ func (w *Walker) emitIfaceType(name string, typ *types.Interface) {
return
}
- sort.Strings(methodNames)
+ slices.Sort(methodNames)
w.emitf("type %s interface { %s }", name, strings.Join(methodNames, ", "))
}