Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cmd/asm/internal/asm/endtoend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"os"
"path/filepath"
"regexp"
"sort"
"slices"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -245,7 +245,7 @@ Diff:
for key := range hexByLine {
missing = append(missing, key)
}
sort.Strings(missing)
slices.Sort(missing)
for _, line := range missing {
t.Errorf("%s: did not find instruction encoding", line)
}
Expand Down Expand Up @@ -367,7 +367,7 @@ func testErrors(t *testing.T, goarch, file string, flags ...string) {
for key := range errors {
extra = append(extra, key)
}
sort.Strings(extra)
slices.Sort(extra)
for _, fileline := range extra {
t.Errorf("unexpected error on %s: %v", fileline, errors[fileline])
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cgo/internal/testshared/shared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"sort"
"slices"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -232,7 +232,7 @@ func cloneGOROOTDeps(goroot string) error {

pkgs := append(strings.Split(strings.TrimSpace(stdDeps), "\n"),
strings.Split(strings.TrimSpace(testdataDeps), "\n")...)
sort.Strings(pkgs)
slices.Sort(pkgs)
var pkgRoots []string
for _, pkg := range pkgs {
parentFound := false
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cgo/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"path/filepath"
"reflect"
"runtime"
"sort"
"slices"
"strings"
"sync"

Expand Down Expand Up @@ -88,7 +88,7 @@ func nameKeys(m map[string]*Name) []string {
for k := range m {
ks = append(ks, k)
}
sort.Strings(ks)
slices.Sort(ks)
return ks
}

Expand Down
4 changes: 2 additions & 2 deletions src/cmd/cgo/out.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"os/exec"
"path/filepath"
"regexp"
"sort"
"slices"
"strings"
"unicode"
)
Expand Down Expand Up @@ -120,7 +120,7 @@ func (p *Package) writeDefs() {
}
typedefNames = append(typedefNames, name)
}
sort.Strings(typedefNames)
slices.Sort(typedefNames)
for _, name := range typedefNames {
def := typedef[name]
fmt.Fprintf(fgo2, "type %s ", name)
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/inline/inlheur/callsite.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"fmt"
"io"
"path/filepath"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -140,7 +140,7 @@ func dumpCallSiteComments(w io.Writer, tab CallSiteTab, ecst encodedCallSiteTab)
for k := range ecst {
tags = append(tags, k)
}
sort.Strings(tags)
slices.Sort(tags)
for _, s := range tags {
v := ecst[s]
fmt.Fprintf(w, "// callsite: %s flagstr %q flagval %d score %d mask %d maskstr %q\n", s, v.props.String(), v.props, v.score, v.mask, v.mask.String())
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/liveness/intervals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"fmt"
"math/rand"
"os"
"sort"
"slices"
"testing"
)

Expand Down Expand Up @@ -306,7 +306,7 @@ func TestRandomIntervalsOverlap(t *testing.T) {
// decide how many segments
segs := rand.Intn(int(*segsflag))
picked := vals[:(segs * 2)]
sort.Ints(picked)
slices.Sort(picked)
ii, err := makeIntervals(picked...)
if err != nil {
t.Fatalf("makeIntervals(%+v) returns err %v", picked, err)
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/compile/internal/liveness/plive.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"fmt"
"os"
"slices"
"sort"
"strings"

"cmd/compile/internal/abi"
Expand Down Expand Up @@ -1163,7 +1162,7 @@ func (lv *Liveness) format(v *ssa.Value, live bitvec.BitVec) (src.XPos, string)
names = append(names, n.Sym().Name)
}
}
sort.Strings(names)
slices.Sort(names)
for _, v := range names {
s += " " + v
}
Expand Down
6 changes: 3 additions & 3 deletions src/cmd/compile/internal/ssa/_gen/rulegen.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"os"
"path"
"regexp"
"sort"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -170,7 +170,7 @@ func genRulesSuffix(arch arch, suff string) {
for op := range oprules {
ops = append(ops, op)
}
sort.Strings(ops)
slices.Sort(ops)

genFile := &File{Arch: arch, Suffix: suff}
// Main rewrite routine is a switch on v.Op.
Expand Down Expand Up @@ -257,7 +257,7 @@ func genRulesSuffix(arch arch, suff string) {
for op := range blockrules {
ops = append(ops, op)
}
sort.Strings(ops)
slices.Sort(ops)
for _, op := range ops {
name, data := getBlockInfo(op, arch)
swc := &Case{Expr: exprf("%s", name)}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/ssa/compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"sort"
"slices"
"strings"
"time"
)
Expand Down Expand Up @@ -150,7 +150,7 @@ func Compile(f *Func) {
for key := range f.ruleMatches {
keys = append(keys, key)
}
sort.Strings(keys)
slices.Sort(keys)
buf := new(strings.Builder)
fmt.Fprintf(buf, "%s: ", f.Name)
for _, key := range keys {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/compile/internal/ssa/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"cmd/internal/src"
"fmt"
"math"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -182,7 +182,7 @@ func (v *Value) LongString() string {
}
}
if len(names) != 0 {
sort.Strings(names) // Otherwise a source of variation in debugging output.
slices.Sort(names) // Otherwise a source of variation in debugging output.
s += " (" + strings.Join(names, ", ") + ")"
}
return s
Expand Down
3 changes: 1 addition & 2 deletions src/cmd/compile/internal/types2/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"internal/goversion"
"internal/testenv"
"slices"
"sort"
"strings"
"sync"
"testing"
Expand Down Expand Up @@ -3098,7 +3097,7 @@ func (recv T) f(param int) (result int) {
got = append(got, fmt.Sprintf("%s: %v", v.Name(), v.Kind()))
}
}
sort.Strings(got)
slices.Sort(got)
want := []string{
"field: FieldVar",
"global: PackageVar",
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/covdata/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"internal/coverage/decodemeta"
"internal/coverage/pods"
"os"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -349,7 +349,7 @@ func (d *dstate) Finish() {
for p := range d.pkgpaths {
pkgs = append(pkgs, p)
}
sort.Strings(pkgs)
slices.Sort(pkgs)
for _, p := range pkgs {
fmt.Printf("%s\n", p)
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/covdata/metamerge.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"io"
"os"
"path/filepath"
"sort"
"slices"
"time"
"unsafe"
)
Expand Down Expand Up @@ -296,7 +296,7 @@ func (mm *metaMerge) VisitFuncs(f encodecounter.CounterVisitorFn) error {
for fid := range p.ctab {
fids = append(fids, int(fid))
}
sort.Ints(fids)
slices.Sort(fids)
if *verbflag >= 4 {
fmt.Printf("fids for pk=%d: %+v\n", pidx, fids)
}
Expand Down
5 changes: 2 additions & 3 deletions src/cmd/dist/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"path/filepath"
"regexp"
"slices"
"sort"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -886,7 +885,7 @@ func runInstall(pkg string, ch chan struct{}) {
for imp := range importMap {
sortedImports = append(sortedImports, imp)
}
sort.Strings(sortedImports)
slices.Sort(sortedImports)

for _, dep := range importMap {
if dep == "C" {
Expand Down Expand Up @@ -1979,7 +1978,7 @@ func cmdlist() {
}
plats = append(plats, p)
}
sort.Strings(plats)
slices.Sort(plats)

if !*jsonFlag {
for _, p := range plats {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/dist/buildgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"io"
"path/filepath"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -77,7 +77,7 @@ func defaultCCFunc(name string, defaultcc map[string]string) string {
keys = append(keys, k)
}
}
sort.Strings(keys)
slices.Sort(keys)
for _, k := range keys {
fmt.Fprintf(&buf, "\tcase %s:\n\t\treturn %s\n", quote(k), quote(defaultcc[k]))
}
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/dist/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"os"
"os/exec"
"path/filepath"
"sort"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -40,7 +40,7 @@ func filter(list []string, f func(string) bool) []string {
func uniq(list []string) []string {
out := make([]string, len(list))
copy(out, list)
sort.Strings(out)
slices.Sort(out)
keep := out[:0]
for _, x := range out {
if len(keep) == 0 || keep[len(keep)-1] != x {
Expand Down
4 changes: 2 additions & 2 deletions src/cmd/go/internal/fsys/glob.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"os"
"path/filepath"
"runtime"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -153,7 +153,7 @@ func glob(dir, pattern string, matches []string) (m []string, e error) {
for _, info := range list {
names = append(names, info.Name())
}
sort.Strings(names)
slices.Sort(names)

for _, n := range names {
matched, err := filepath.Match(pattern, n)
Expand Down
14 changes: 3 additions & 11 deletions src/cmd/go/internal/imports/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ package imports
import (
"fmt"
"io/fs"
"maps"
"path/filepath"
"sort"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -93,16 +94,7 @@ Files:
if numFiles == 0 {
return nil, nil, ErrNoGo
}
return keys(imports), keys(testImports), nil
return slices.Sorted(maps.Keys(imports)), slices.Sorted(maps.Keys(testImports)), nil
}

var ErrNoGo = fmt.Errorf("no Go source files")

func keys(m map[string]bool) []string {
list := make([]string, 0, len(m))
for k := range m {
list = append(list, k)
}
sort.Strings(list)
return list
}
5 changes: 3 additions & 2 deletions src/cmd/go/internal/list/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"os"
"reflect"
"runtime"
"slices"
"sort"
"strconv"
"strings"
Expand Down Expand Up @@ -392,7 +393,7 @@ func (v *jsonFlag) String() string {
for f := range *v {
fields = append(fields, f)
}
sort.Strings(fields)
slices.Sort(fields)
return strings.Join(fields, ",")
}

Expand Down Expand Up @@ -927,7 +928,7 @@ func collectDeps(p *load.Package) {
for dep := range deps {
p.Deps = append(p.Deps, dep)
}
sort.Strings(p.Deps)
slices.Sort(p.Deps)
}

// collectDepsErrors populates p.DepsErrors by iterating over p.Internal.Imports.
Expand Down
Loading