woodpecker/vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go
6543 4df9c8d6a5
Update Dependencies (#349)
* github.com/russross/meddler v1.0.0 -> v1.0.1
* github.com/gin-gonic/gin v1.6.3 -> v1.7.4
* github.com/go-sql-driver/mysql v1.5.0 -> v1.6.0
* github.com/sirupsen/logrus v1.6.0 -> v1.8.1
* github.com/rs/zerolog v1.18.0 -> v1.25.0
2021-09-24 18:39:57 +02:00

24 lines
566 B
Go

// +build !go1.12
package fmtsort
import "reflect"
const brokenNaNs = true
func mapElems(mapValue reflect.Value) ([]reflect.Value, []reflect.Value) {
key := mapValue.MapKeys()
value := make([]reflect.Value, 0, len(key))
for _, k := range key {
v := mapValue.MapIndex(k)
if !v.IsValid() {
// Note: we can't retrieve the value, probably because
// the key is NaN, so just do the best we can and
// add a zero value of the correct type in that case.
v = reflect.Zero(mapValue.Type().Elem())
}
value = append(value, v)
}
return key, value
}