From 3dcd276212004d20349dcc1459d83f2e78a28158 Mon Sep 17 00:00:00 2001 From: Gealber Date: Sat, 8 Jun 2024 15:17:49 +0200 Subject: [PATCH] replacing sort.Slice with slices.SortFunc --- p2p/server.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/p2p/server.go b/p2p/server.go index ae53e29707..172f0667eb 100644 --- a/p2p/server.go +++ b/p2p/server.go @@ -19,6 +19,7 @@ package p2p import ( "bytes" + "cmp" "crypto/ecdsa" "encoding/hex" "errors" @@ -26,7 +27,6 @@ import ( "net" "net/netip" "slices" - "sort" "sync" "sync/atomic" "time" @@ -1141,8 +1141,8 @@ func (srv *Server) PeersInfo() []*PeerInfo { } } // Sort the result array alphabetically by node identifier - sort.Slice(infos, func(i, j int) bool { - return infos[i].ID < infos[j].ID + slices.SortFunc(infos, func(a, b *PeerInfo) int { + return cmp.Compare(a.ID, b.ID) }) return infos