From a95c5abe6cdde71713def20d7a7de8a8d866bce8 Mon Sep 17 00:00:00 2001 From: peterlimg Date: Thu, 22 Jul 2021 14:54:11 +1000 Subject: [PATCH] Fix indent issue for embed struct with tag --- internal/encoder/compiler.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/encoder/compiler.go b/internal/encoder/compiler.go index 01a5d4b..a18ab4d 100644 --- a/internal/encoder/compiler.go +++ b/internal/encoder/compiler.go @@ -1425,7 +1425,10 @@ func compileStruct(ctx *compileContext, isPtr bool) (*Opcode, error) { for k, v := range anonymousStructFieldPairMap(tags, tagKey, valueCode) { anonymousFields[k] = append(anonymousFields[k], v...) } - valueCode.decIndent() + + if !tag.IsTaggedKey { + valueCode.decIndent() + } // fix issue144 if !(isPtr && strings.Contains(valueCode.Op.String(), "Marshal")) {