all: update golang/x/ext and fix slice sorting fallout (#27909)

The Go authors updated golang/x/ext to change the function signature of the slices sort method. 
It's an entire shitshow now because x/ext is not tagged, so everyone's codebase just 
picked a new version that some other dep depends on, causing our code to fail building.

This PR updates the dep on our code too and does all the refactorings to follow upstream...
This commit is contained in:
Péter Szilágyi
2023-08-12 00:04:12 +02:00
committed by GitHub
parent 0ce331f56a
commit be65b47645
38 changed files with 144 additions and 113 deletions
+2 -4
View File
@@ -18,10 +18,10 @@ package trienode
import (
"fmt"
"sort"
"strings"
"github.com/ethereum/go-ethereum/common"
"golang.org/x/exp/slices"
)
// Node is a wrapper which contains the encoded blob of the trie node and its
@@ -83,9 +83,7 @@ func (set *NodeSet) ForEachWithOrder(callback func(path string, n *Node)) {
paths = append(paths, path)
}
// Bottom-up, the longest path first
slices.SortFunc(paths, func(a, b string) bool {
return a > b // Sort in reverse order
})
sort.Sort(sort.Reverse(sort.StringSlice(paths)))
for _, path := range paths {
callback(path, set.Nodes[path])
}