Don't check for types that don't support the == operator.
This isn't necessary to do because these types cannot be keys in the first place.
This commit is contained in:
parent
59a3ca0a76
commit
d1afd4f613
|
@ -358,16 +358,6 @@ func valueSortLess(a, b reflect.Value) bool {
|
||||||
case reflect.Uintptr:
|
case reflect.Uintptr:
|
||||||
return a.Uint() < b.Uint()
|
return a.Uint() < b.Uint()
|
||||||
case reflect.Array:
|
case reflect.Array:
|
||||||
// Skip array types that do not support the == operator.
|
|
||||||
t := a.Type().Elem()
|
|
||||||
if t.Kind() == reflect.Interface {
|
|
||||||
t = a.Elem().Type()
|
|
||||||
}
|
|
||||||
switch t.Kind() {
|
|
||||||
case reflect.Slice, reflect.Map, reflect.Func:
|
|
||||||
goto unsupported
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compare the contents of both arrays.
|
// Compare the contents of both arrays.
|
||||||
l := a.Len()
|
l := a.Len()
|
||||||
for i := 0; i < l; i++ {
|
for i := 0; i < l; i++ {
|
||||||
|
@ -380,8 +370,6 @@ func valueSortLess(a, b reflect.Value) bool {
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
unsupported:
|
|
||||||
return a.String() < b.String()
|
return a.String() < b.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue