From 260c426a4c1e2947ae2fbc053af7c20c3558488e Mon Sep 17 00:00:00 2001 From: a Date: Wed, 19 Jul 2023 21:01:41 -0500 Subject: [PATCH] newline --- encode.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/encode.go b/encode.go index 4bd899f..37ca392 100644 --- a/encode.go +++ b/encode.go @@ -84,7 +84,9 @@ func (e *Encoder) encodeWithOption(ctx *encoder.RuntimeContext, v interface{}, o } else { buf = buf[:len(buf)-1] } - buf = append(buf, '\n') + if !ctx.Option.DisableNewline { + buf = append(buf, '\n') + } if _, err := e.w.Write(buf); err != nil { return err }