This commit is contained in:
a 2024-11-22 06:54:47 +00:00 committed by GitHub
commit 9d7582fa11
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View File

@ -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
}

View File

@ -24,6 +24,7 @@ type Option struct {
Context context.Context
DebugOut io.Writer
DebugDOTOut io.WriteCloser
DisableNewline bool
}
type EncodeFormat struct {