修复anyType IsNil判断的BUG

This commit is contained in:
2024-09-24 14:34:49 +08:00
parent c38d16dc28
commit ef80c6cb79
3 changed files with 12 additions and 2 deletions

10
any.go
View File

@ -46,7 +46,15 @@ func (at *AnyType) IsNil() bool {
if at.data == nil {
return true
}
return reflect.ValueOf(at.data).IsNil()
reflectValue := reflect.ValueOf(at.data)
switch reflectValue.Kind() {
case reflect.Chan, reflect.Func, reflect.Map,
reflect.Pointer, reflect.UnsafePointer,
reflect.Interface, reflect.Slice:
return reflectValue.IsNil()
default:
return false
}
}
// Type 获取类型