From da44ae07ab9b4672ffb86d9ef7881efbd8622876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Tue, 13 Aug 2024 16:30:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96IsNil=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- any.go | 5 ++++- object.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/any.go b/any.go index d28e834..5454fa7 100644 --- a/any.go +++ b/any.go @@ -43,7 +43,10 @@ type AnyType struct { // // Date : 18:21 2023/6/1 func (at *AnyType) IsNil() bool { - return at.data == nil + if at.data == nil { + return true + } + return reflect.ValueOf(at.data).IsNil() } // Type 获取类型 diff --git a/object.go b/object.go index 197296d..f7b3972 100644 --- a/object.go +++ b/object.go @@ -71,7 +71,10 @@ func (ot *ObjectType) IsValid() bool { // // Date : 18:50 2023/6/1 func (ot *ObjectType) IsNil() bool { - return ot.source == nil + if ot.source == nil { + return true + } + return reflect.ValueOf(ot.source).IsNil() } // ToString 转字符串