Update vendored libs
This commit is contained in:
3
vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem.go
generated
vendored
3
vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem.go
generated
vendored
@@ -1,3 +1,6 @@
|
||||
//go:build go1.12
|
||||
// +build go1.12
|
||||
|
||||
package fmtsort
|
||||
|
||||
import "reflect"
|
||||
|
||||
24
vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go
generated
vendored
Normal file
24
vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
//go:build !go1.12
|
||||
// +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
|
||||
}
|
||||
25
vendor/github.com/rogpeppe/go-internal/fmtsort/sort.go
generated
vendored
25
vendor/github.com/rogpeppe/go-internal/fmtsort/sort.go
generated
vendored
@@ -36,18 +36,19 @@ func (o *SortedMap) Swap(i, j int) {
|
||||
//
|
||||
// The ordering rules are more general than with Go's < operator:
|
||||
//
|
||||
// - when applicable, nil compares low
|
||||
// - ints, floats, and strings order by <
|
||||
// - NaN compares less than non-NaN floats
|
||||
// - bool compares false before true
|
||||
// - complex compares real, then imag
|
||||
// - pointers compare by machine address
|
||||
// - channel values compare by machine address
|
||||
// - structs compare each field in turn
|
||||
// - arrays compare each element in turn.
|
||||
// Otherwise identical arrays compare by length.
|
||||
// - interface values compare first by reflect.Type describing the concrete type
|
||||
// and then by concrete value as described in the previous rules.
|
||||
// - when applicable, nil compares low
|
||||
// - ints, floats, and strings order by <
|
||||
// - NaN compares less than non-NaN floats
|
||||
// - bool compares false before true
|
||||
// - complex compares real, then imag
|
||||
// - pointers compare by machine address
|
||||
// - channel values compare by machine address
|
||||
// - structs compare each field in turn
|
||||
// - arrays compare each element in turn.
|
||||
// Otherwise identical arrays compare by length.
|
||||
// - interface values compare first by reflect.Type describing the concrete type
|
||||
// and then by concrete value as described in the previous rules.
|
||||
//
|
||||
func Sort(mapValue reflect.Value) *SortedMap {
|
||||
if mapValue.Type().Kind() != reflect.Map {
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user