diff --git a/printer.go b/printer.go index db51b56..7fe237c 100644 --- a/printer.go +++ b/printer.go @@ -382,6 +382,9 @@ func (p *Printer) Store(v interface{}, appendNewLine bool) error { // // Returns this WriteTo's result information such as error, written. func (p *Printer) WriteTo(v interface{}, w io.Writer, appendNewLine bool) ([]byte, error) { + p.mu.Lock() + defer p.mu.Unlock() + var marshaler Marshaler // check if implements the Marshaled