From 7893f828d32c90bb082156ded0689751ca987bc5 Mon Sep 17 00:00:00 2001 From: dudaodong Date: Mon, 13 May 2024 17:49:34 +0800 Subject: [PATCH] fix: fix get tag failed --- maputil/map.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/maputil/map.go b/maputil/map.go index e724dba..252dbde 100644 --- a/maputil/map.go +++ b/maputil/map.go @@ -6,9 +6,11 @@ package maputil import ( "fmt" - "golang.org/x/exp/constraints" "reflect" "sort" + "strings" + + "golang.org/x/exp/constraints" "github.com/duke-git/lancet/v2/slice" ) @@ -379,7 +381,7 @@ func getFieldNameByJsonTag(structObj any, jsonTag string) string { tag := field.Tag name := tag.Get("json") - if name == jsonTag { + if strings.Contains(name, jsonTag) { return field.Name } }