Fix removal of maps.Keys in go1.21rc4
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
73194bd79f
commit
6ba8959a8a
|
@ -21,7 +21,6 @@ import (
|
|||
"github.com/gorilla/mux"
|
||||
"io"
|
||||
"log"
|
||||
"maps"
|
||||
"math"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
|
@ -1556,7 +1555,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
sortedAddresses := maps.Keys(addresses)
|
||||
sortedAddresses := utils.Keys(addresses)
|
||||
|
||||
//Sort based on addresses
|
||||
slices.SortFunc(sortedAddresses, func(a address.PackedAddress, b address.PackedAddress) int {
|
||||
|
|
|
@ -18,7 +18,6 @@ import (
|
|||
"github.com/valyala/quicktemplate"
|
||||
"io"
|
||||
"log"
|
||||
"maps"
|
||||
"math"
|
||||
"net/http"
|
||||
_ "net/http/pprof"
|
||||
|
@ -722,7 +721,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
|
||||
minerKeys := maps.Keys(miners)
|
||||
minerKeys := utils.Keys(miners)
|
||||
slices.SortFunc(minerKeys, func(a uint64, b uint64) int {
|
||||
return miners[a].Weight.Cmp(miners[b].Weight) * -1
|
||||
})
|
||||
|
|
9
utils/maps.go
Normal file
9
utils/maps.go
Normal file
|
@ -0,0 +1,9 @@
|
|||
package utils
|
||||
|
||||
func Keys[M ~map[K]V, K comparable, V any](m M) []K {
|
||||
r := make([]K, 0, len(m))
|
||||
for k := range m {
|
||||
r = append(r, k)
|
||||
}
|
||||
return r
|
||||
}
|
Loading…
Reference in a new issue