mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 18:32:23 +00:00
replacing sort.Slice with slices.SortFunc
This commit is contained in:
parent
b6e88e78b5
commit
3dcd276212
1 changed files with 3 additions and 3 deletions
|
|
@ -19,6 +19,7 @@ package p2p
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"cmp"
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
@ -26,7 +27,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"net/netip"
|
"net/netip"
|
||||||
"slices"
|
"slices"
|
||||||
"sort"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -1141,8 +1141,8 @@ func (srv *Server) PeersInfo() []*PeerInfo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Sort the result array alphabetically by node identifier
|
// Sort the result array alphabetically by node identifier
|
||||||
sort.Slice(infos, func(i, j int) bool {
|
slices.SortFunc(infos, func(a, b *PeerInfo) int {
|
||||||
return infos[i].ID < infos[j].ID
|
return cmp.Compare(a.ID, b.ID)
|
||||||
})
|
})
|
||||||
|
|
||||||
return infos
|
return infos
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue