From c1a22496e39c7ebe9248ad030416bc183f7c6ae9 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Thu, 8 Jun 2023 15:46:35 +0530 Subject: [PATCH 1/2] skip tagging type if value is nil --- caching_tag.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/caching_tag.go b/caching_tag.go index b7ae850..7babb5d 100644 --- a/caching_tag.go +++ b/caching_tag.go @@ -118,7 +118,9 @@ func (c *cachingTagVisitor) collectTypeKeyTags(path []string, data interface{}, c.collectTypeKeyTags(path, item, typeName) } case map[string]interface{}: - c.addTagForTypeKey(at, v[at], typeName) + if v[at] != nil { + c.addTagForTypeKey(at, v[at], typeName) + } default: c.Walker.StopWithInternalErr(fmt.Errorf("invalid data type expected map or array map but got %T", v)) } From 0a5fce60e55529a3cdb711122570553955fc6924 Mon Sep 17 00:00:00 2001 From: Ankit Kumar Date: Fri, 9 Jun 2023 11:23:37 +0530 Subject: [PATCH 2/2] skip tagging type if value is nil --- caching_tag.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/caching_tag.go b/caching_tag.go index 7babb5d..47725da 100644 --- a/caching_tag.go +++ b/caching_tag.go @@ -122,7 +122,9 @@ func (c *cachingTagVisitor) collectTypeKeyTags(path []string, data interface{}, c.addTagForTypeKey(at, v[at], typeName) } default: - c.Walker.StopWithInternalErr(fmt.Errorf("invalid data type expected map or array map but got %T", v)) + if v != nil { + c.Walker.StopWithInternalErr(fmt.Errorf("invalid data type expected map or array map but got %T", v)) + } } }