forked from mirror/go-json
Refactor
This commit is contained in:
parent
0d57bf1014
commit
d2de9a1eb5
|
@ -1134,16 +1134,7 @@ func encodeAnonymousFieldPairRecursively(tags structTags, named string, valueCod
|
||||||
f := valueCode
|
f := valueCode
|
||||||
var prevAnonymousField *opcode
|
var prevAnonymousField *opcode
|
||||||
for {
|
for {
|
||||||
if f.displayKey == "" {
|
if f.displayKey != "" && strings.Contains(f.op.String(), "Anonymous") {
|
||||||
if f.nextField == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
prevAnonymousField = f
|
|
||||||
f = f.nextField
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if strings.Contains(f.op.String(), "Anonymous") {
|
|
||||||
key := fmt.Sprintf("%s.%s", named, f.displayKey)
|
key := fmt.Sprintf("%s.%s", named, f.displayKey)
|
||||||
anonymousFields[key] = append(anonymousFields[key], structFieldPair{
|
anonymousFields[key] = append(anonymousFields[key], structFieldPair{
|
||||||
prevField: prevAnonymousField,
|
prevField: prevAnonymousField,
|
||||||
|
|
Loading…
Reference in New Issue