Skip to content

Commit db95112

Browse files
author
lazada-ws-duc_ha
committed
get correct field name in struct tag that contain comma, such as json tag
1 parent 5b5b101 commit db95112

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cache.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"reflect"
55
"sync"
66
"sync/atomic"
7+
"strings"
78
)
89

910
type cachedField struct {
@@ -76,6 +77,10 @@ func (s *structCacheMap) parseStruct(mode Mode, current reflect.Value, key refle
7677
continue
7778
}
7879

80+
if commaIndex := strings.Index(name, ","); commaIndex != -1 {
81+
name = name[:commaIndex]
82+
}
83+
7984
if mode == ModeExplicit && len(name) == 0 {
8085
continue
8186
}

0 commit comments

Comments
 (0)