File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import (
1515 "fmt"
1616 "log"
1717 "os"
18- "sort" //nolint:depguard // preexisting
18+ "slices"
1919 "strings"
2020
2121 "github.com/maxmind/mm-geofeed-verifier/v4/verify"
@@ -55,7 +55,7 @@ func run() error {
5555 )
5656 if err != nil {
5757 if errors .Is (err , verify .ErrInvalidGeofeed ) {
58- log .Printf ( //nolint:gosec // logging verified geofeed data
58+ log .Printf (
5959 "Found %d invalid rows out of %d rows in total, examples by type:" ,
6060 c .Invalid ,
6161 c .Total ,
@@ -79,10 +79,17 @@ func run() error {
7979 for asNumber := range asnCounts {
8080 asNumbers = append (asNumbers , asNumber )
8181 }
82- sort . Slice (
82+ slices . SortFunc (
8383 asNumbers ,
84- func (i , j int ) bool {
85- return asnCounts [asNumbers [i ]] > asnCounts [asNumbers [j ]]
84+ func (a , b uint ) int {
85+ switch {
86+ case asnCounts [a ] > asnCounts [b ]:
87+ return - 1
88+ case asnCounts [a ] < asnCounts [b ]:
89+ return 1
90+ default :
91+ return 0
92+ }
8693 },
8794 )
8895 for _ , asNumber := range asNumbers {
You can’t perform that action at this time.
0 commit comments