From 65d954de3ee78cdf6ee1377fe822214d72737af8 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima <goccy54@gmail.com> Date: Sat, 15 Aug 2020 21:13:08 +0900 Subject: [PATCH] Fix unnecessary recursive operation --- encode_compile.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/encode_compile.go b/encode_compile.go index 2817a66..d6c8b93 100644 --- a/encode_compile.go +++ b/encode_compile.go @@ -602,5 +602,12 @@ func (e *Encoder) compileStruct(typ *rtype, root, withIndent bool) (*opcode, err code.next = structEndCode ret := (*opcode)(unsafe.Pointer(head)) compiled.code = ret + + if withIndent { + delete(e.structTypeToCompiledIndentCode, typeptr) + } else { + delete(e.structTypeToCompiledCode, typeptr) + } + return ret, nil }