Update dependencies
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,6 +1,3 @@
|
||||
//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
24
vendor/github.com/rogpeppe/go-internal/fmtsort/mapelem_1.11.go
generated
vendored
@@ -1,24 +0,0 @@
|
||||
//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
|
||||
}
|
||||
29
vendor/github.com/rogpeppe/go-internal/fmtsort/sort.go
generated
vendored
29
vendor/github.com/rogpeppe/go-internal/fmtsort/sort.go
generated
vendored
@@ -36,19 +36,18 @@ 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
|
||||
@@ -144,14 +143,14 @@ func compare(aVal, bVal reflect.Value) int {
|
||||
return 0
|
||||
}
|
||||
case reflect.Struct:
|
||||
for i := 0; i < aVal.NumField(); i++ {
|
||||
for i := range aVal.NumField() {
|
||||
if c := compare(aVal.Field(i), bVal.Field(i)); c != 0 {
|
||||
return c
|
||||
}
|
||||
}
|
||||
return 0
|
||||
case reflect.Array:
|
||||
for i := 0; i < aVal.Len(); i++ {
|
||||
for i := range aVal.Len() {
|
||||
if c := compare(aVal.Index(i), bVal.Index(i)); c != 0 {
|
||||
return c
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user