If array element is not interface, array or struct, we just need to
check whether the array element type is comparable.
Change-Id: I1ab94cfa17ae86feb6cd3fbdf878af5a776e7bec
Reviewed-on: https://go-review.googlesource.com/c/go/+/426194
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
return true
case Array:
- if v.Type().Len() == 0 {
- return v.Type().Comparable()
- }
-
switch v.Type().Elem().Kind() {
case Interface, Array, Struct:
for i := 0; i < v.Type().Len(); i++ {
return false
}
}
- default:
- return v.Index(0).Comparable()
}
-
- return true
+ return v.Type().Comparable()
case Func:
return false