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
3 changes: 1 addition & 2 deletions accounts/abi/abigen/bindv2.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"reflect"
"regexp"
"slices"
"sort"
"strings"
"text/template"
"unicode"
Expand Down Expand Up @@ -280,7 +279,7 @@ func iterSorted[V any](inp map[string]V, onItem func(string, V) error) error {
for key := range inp {
sortedKeys = append(sortedKeys, key)
}
sort.Strings(sortedKeys)
slices.Sort(sortedKeys)

for _, key := range sortedKeys {
if err := onItem(key, inp[key]); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/puppeth/wizard.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"net"
"os"
"path/filepath"
"sort"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -53,7 +53,7 @@ func (c config) servers() []string {
for server := range c.Servers {
servers = append(servers, server)
}
sort.Strings(servers)
slices.Sort(servers)

return servers
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/puppeth/wizard_ethstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package main

import (
"fmt"
"sort"
"slices"

"github.com/XinFinOrg/XDPoSChain/log"
)
Expand Down Expand Up @@ -98,7 +98,7 @@ func (w *wizard) deployEthstats() {
}
break
}
sort.Strings(infos.banned)
slices.Sort(infos.banned)
}
}
// Try to deploy the ethstats server on the host
Expand Down
8 changes: 4 additions & 4 deletions cmd/puppeth/wizard_netstats.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package main
import (
"encoding/json"
"os"
"sort"
"slices"
"strings"
"sync"

Expand Down Expand Up @@ -226,7 +226,7 @@ func (stats serverStats) render() {
for server := range stats {
servers = append(servers, server)
}
sort.Strings(servers)
slices.Sort(servers)

for i, server := range servers {
// Add a separator between all servers
Expand All @@ -238,7 +238,7 @@ func (stats serverStats) render() {
for service := range stats[server].services {
services = append(services, service)
}
sort.Strings(services)
slices.Sort(services)

if len(services) == 0 {
table.Append([]string{server, stats[server].address, "", "", ""})
Expand All @@ -253,7 +253,7 @@ func (stats serverStats) render() {
for service := range stats[server].services[service] {
configs = append(configs, service)
}
sort.Strings(configs)
slices.Sort(configs)

for k, config := range configs {
switch {
Expand Down
4 changes: 2 additions & 2 deletions console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"os/signal"
"path/filepath"
"regexp"
"sort"
"slices"
"strings"
"sync"
"syscall"
Expand Down Expand Up @@ -317,7 +317,7 @@ func (c *Console) Welcome() {
for api, version := range apis {
modules = append(modules, fmt.Sprintf("%s:%s", api, version))
}
sort.Strings(modules)
slices.Sort(modules)
message += " modules: " + strings.Join(modules, " ") + "\n"
}
message += "\nTo exit, press ctrl-d or type exit"
Expand Down
6 changes: 3 additions & 3 deletions ethdb/dbtest/testsuite.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package dbtest
import (
"bytes"
"reflect"
"sort"
"slices"
"testing"

"github.com/XinFinOrg/XDPoSChain/ethdb"
Expand Down Expand Up @@ -133,7 +133,7 @@ func TestDatabaseSuite(t *testing.T, New func() ethdb.KeyValueStore) {
defer db.Close()

keys := []string{"1", "2", "3", "4", "6", "10", "11", "12", "20", "21", "22"}
sort.Strings(keys) // 1, 10, 11, etc
slices.Sort(keys) // 1, 10, 11, etc

for _, k := range keys {
if err := db.Put([]byte(k), nil); err != nil {
Expand Down Expand Up @@ -319,7 +319,7 @@ func iterateKeys(it ethdb.Iterator) []string {
for it.Next() {
keys = append(keys, string(it.Key()))
}
sort.Strings(keys)
slices.Sort(keys)
it.Release()
return keys
}
4 changes: 2 additions & 2 deletions ethdb/memorydb/memorydb.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package memorydb

import (
"errors"
"sort"
"slices"
"strings"
"sync"

Expand Down Expand Up @@ -160,7 +160,7 @@ func (db *Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator {
}
}
// Sort the items and retrieve the associated values
sort.Strings(keys)
slices.Sort(keys)
for _, key := range keys {
values = append(values, db.db[key])
}
Expand Down
4 changes: 2 additions & 2 deletions internal/build/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"io"
"os"
"path/filepath"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -97,6 +97,6 @@ func DiffHashes(a map[string][32]byte, b map[string][32]byte) []string {
updates = append(updates, file)
}
}
sort.Strings(updates)
slices.Sort(updates)
return updates
}
4 changes: 2 additions & 2 deletions internal/flags/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"os"
"regexp"
"sort"
"slices"
"strings"

"github.com/XinFinOrg/XDPoSChain/log"
Expand Down Expand Up @@ -276,7 +276,7 @@ func CheckEnvVars(ctx *cli.Context, flags []cli.Flag, prefix string) {
}
}
keyvals := os.Environ()
sort.Strings(keyvals)
slices.Sort(keyvals)

for _, keyval := range keyvals {
key := strings.Split(keyval, "=")[0]
Expand Down
4 changes: 2 additions & 2 deletions internal/jsre/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package jsre

import (
"regexp"
"sort"
"slices"
"strings"

"github.com/dop251/goja"
Expand Down Expand Up @@ -88,6 +88,6 @@ func getCompletions(vm *goja.Runtime, line string) (results []string) {
}
}

sort.Strings(results)
slices.Sort(results)
return results
}
6 changes: 3 additions & 3 deletions internal/jsre/pretty.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"fmt"
"io"
"reflect"
"sort"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -221,8 +221,8 @@ func (ctx ppctx) fields(obj *goja.Object) []string {
}
}
iterOwnAndConstructorKeys(ctx.vm, obj, add)
sort.Strings(vals)
sort.Strings(methods)
slices.Sort(vals)
slices.Sort(methods)
return append(vals, methods...)
}

Expand Down
4 changes: 2 additions & 2 deletions metrics/prometheus/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package prometheus
import (
"bytes"
"fmt"
"sort"
"slices"
"strconv"
"strings"

Expand Down Expand Up @@ -144,7 +144,7 @@ func (c *collector) writeGaugeInfo(name string, value metrics.GaugeInfoValue) {
for k, v := range value {
kvs = append(kvs, fmt.Sprintf("%v=%q", k, v))
}
sort.Strings(kvs)
slices.Sort(kvs)
c.buff.WriteString(fmt.Sprintf("{%v} 1\n\n", strings.Join(kvs, ", ")))
}

Expand Down
4 changes: 2 additions & 2 deletions metrics/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ package prometheus
import (
"fmt"
"net/http"
"sort"
"slices"

"github.com/XinFinOrg/XDPoSChain/log"
"github.com/XinFinOrg/XDPoSChain/metrics"
Expand All @@ -34,7 +34,7 @@ func Handler(reg metrics.Registry) http.Handler {
reg.Each(func(name string, i interface{}) {
names = append(names, name)
})
sort.Strings(names)
slices.Sort(names)

// Aggregate all the metrics into a Prometheus collector
c := newCollector()
Expand Down
4 changes: 2 additions & 2 deletions metrics/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package metrics
import (
"errors"
"fmt"
"sort"
"slices"
"strings"
"sync"
)
Expand Down Expand Up @@ -54,7 +54,7 @@ func (r *orderedRegistry) Each(f func(string, interface{})) {
for name := range reg {
names = append(names, name)
}
sort.Strings(names)
slices.Sort(names)
for _, name := range names {
f(name, reg[name])
}
Expand Down
4 changes: 2 additions & 2 deletions node/rpcstack.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
"io"
"net"
"net/http"
"sort"
"slices"
"strconv"
"strings"
"sync"
Expand Down Expand Up @@ -183,7 +183,7 @@ func (h *httpServer) start() error {
for path := range h.handlerNames {
paths = append(paths, path)
}
sort.Strings(paths)
slices.Sort(paths)
logged := make(map[string]bool, len(paths))
for _, path := range paths {
name := h.handlerNames[path]
Expand Down
4 changes: 2 additions & 2 deletions p2p/netutil/net.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"errors"
"fmt"
"net"
"sort"
"slices"
"strings"
)

Expand Down Expand Up @@ -303,7 +303,7 @@ func (s DistinctNetSet) String() string {
for k := range s.members {
keys = append(keys, k)
}
sort.Strings(keys)
slices.Sort(keys)
for i, k := range keys {
var ip net.IP
if k[0] == '4' {
Expand Down
4 changes: 2 additions & 2 deletions rlp/rlpgen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"fmt"
"go/format"
"go/types"
"sort"
"slices"

"github.com/XinFinOrg/XDPoSChain/rlp/internal/rlpstruct"
"golang.org/x/tools/go/packages"
Expand Down Expand Up @@ -194,7 +194,7 @@ func (ctx *genContext) importsList() []string {
imp = append(imp, fmt.Sprintf("%s %q", p.alias, path))
}
}
sort.Strings(imp)
slices.Sort(imp)
return imp
}

Expand Down
4 changes: 2 additions & 2 deletions tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"path/filepath"
"reflect"
"regexp"
"sort"
"slices"
"strings"
"testing"

Expand Down Expand Up @@ -261,7 +261,7 @@ func sortedMapKeys(m reflect.Value) []string {
for i, k := range m.MapKeys() {
keys[i] = k.String()
}
sort.Strings(keys)
slices.Sort(keys)
return keys
}

Expand Down