assert: simplify getLen() implementation

pull/1445/head
Olivier Mengué 2023-07-31 00:09:47 +02:00
parent a23f5db224
commit 7a796b8f87
1 changed files with 1 additions and 3 deletions

View File

@ -736,9 +736,7 @@ func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
func getLen(x interface{}) (ok bool, length int) {
v := reflect.ValueOf(x)
defer func() {
if e := recover(); e != nil {
ok = false
}
ok = recover() == nil
}()
return true, v.Len()
}