1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-13 09:12:28 +08:00

fix: fix get tag failed

This commit is contained in:
dudaodong
2024-05-13 17:49:34 +08:00
parent 53fa210f09
commit 7893f828d3

View File

@@ -6,9 +6,11 @@ package maputil
import ( import (
"fmt" "fmt"
"golang.org/x/exp/constraints"
"reflect" "reflect"
"sort" "sort"
"strings"
"golang.org/x/exp/constraints"
"github.com/duke-git/lancet/v2/slice" "github.com/duke-git/lancet/v2/slice"
) )
@@ -379,7 +381,7 @@ func getFieldNameByJsonTag(structObj any, jsonTag string) string {
tag := field.Tag tag := field.Tag
name := tag.Get("json") name := tag.Get("json")
if name == jsonTag { if strings.Contains(name, jsonTag) {
return field.Name return field.Name
} }
} }