Skip to content

Commit 69e834e

Browse files
committed
test(evm): use typed sorting for trace totals
Use slices.SortFunc and cmp.Compare for descending trace totals, removing index-based sort closure access.
1 parent 670af4e commit 69e834e

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

test/e2e/evm_test_common.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
package e2e
1616

1717
import (
18+
"cmp"
1819
"context"
1920
"flag"
2021
"fmt"
@@ -23,7 +24,7 @@ import (
2324
"os"
2425
"path/filepath"
2526
"regexp"
26-
"sort"
27+
"slices"
2728
"strconv"
2829
"strings"
2930
"testing"
@@ -904,8 +905,8 @@ func PrintTraceReport(t testing.TB, label string, spans []TraceSpan) {
904905
for name := range m {
905906
names = append(names, name)
906907
}
907-
sort.Slice(names, func(i, j int) bool {
908-
return m[names[i]].Total > m[names[j]].Total
908+
slices.SortFunc(names, func(a, b string) int {
909+
return cmp.Compare(m[b].Total, m[a].Total)
909910
})
910911

911912
var overallTotal time.Duration

0 commit comments

Comments
 (0)