Skip to content

Commit

Permalink
Fix incorrect indent
Browse files Browse the repository at this point in the history
  • Loading branch information
peterlimg committed Jul 22, 2021
1 parent a95c5ab commit ad245e5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions internal/encoder/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) {
valueCode = code
}

if field.Anonymous {
if field.Anonymous && !tag.IsTaggedKey {
tagKey := ""
if tag.IsTaggedKey {
tagKey = tag.Key
Expand All @@ -1426,9 +1426,7 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) {
anonymousFields[k] = append(anonymousFields[k], v...)
}

if !tag.IsTaggedKey {
valueCode.decIndent()
}
valueCode.decIndent()

// fix issue144
if !(isPtr && strings.Contains(valueCode.Op.String(), "Marshal")) {
Expand Down

0 comments on commit ad245e5

Please sign in to comment.