Update dependencies

This commit is contained in:
eleksir
2026-02-10 20:54:39 +03:00
parent f2fc168abe
commit 170d0d0ed4
559 changed files with 66718 additions and 72415 deletions

View File

@@ -1,6 +1,3 @@
//go:build go1.12
// +build go1.12
package fmtsort
import "reflect"

View File

@@ -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
}

View File

@@ -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
}