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 10, 2024
1 parent 9c6e7e6 commit eacacf2
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())
})

return items
}
Expand Down

0 comments on commit eacacf2

Please sign in to comment.