Skip to content

Commit

Permalink
update slices.SortFunc usage
Browse files Browse the repository at this point in the history
  • Loading branch information
gartnera committed Oct 8, 2024
1 parent 890a629 commit f0b3b08
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion zetaclient/context/chain.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package context

import (
"cmp"
"fmt"
"sync"

Expand Down Expand Up @@ -65,7 +66,9 @@ func (cr *ChainRegistry) Get(chainID int64) (Chain, error) {
func (cr *ChainRegistry) All() []Chain {
items := maps.Values(cr.chains)

slices.SortFunc(items, func(a, b Chain) bool { return a.ID() < b.ID() })
slices.SortFunc(items, func(a, b Chain) int {
return cmp.Compare(a.ID(), b.ID())
})

Check warning on line 71 in zetaclient/context/chain.go

View check run for this annotation

Codecov / codecov/patch

zetaclient/context/chain.go#L69-L71

Added lines #L69 - L71 were not covered by tests

return items
}
Expand Down

0 comments on commit f0b3b08

Please sign in to comment.