gojay

high performance JSON encoder/decoder with stream API for Golang
git clone git://git.lair.cx/gojay
Log | Files | Refs | README | LICENSE

commit 688c5d008625b62011496858a3e55f852dccd40f
parent 72314a566cd6141b7e6dac6792ec146936c5708f
Author: francoispqt <francois@parquet.ninja>
Date:   Thu, 18 Oct 2018 17:37:02 +0800

replace buffer when borrowing encoding to avoid race condition

Diffstat:
Mencode_pool.go | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/encode_pool.go b/encode_pool.go @@ -35,7 +35,7 @@ func NewEncoder(w io.Writer) *Encoder { func BorrowEncoder(w io.Writer) *Encoder { enc := encPool.Get().(*Encoder) enc.w = w - enc.buf = enc.buf[:0] + enc.buf = make([]byte, 0, 512) enc.isPooled = 0 enc.err = nil enc.hasKeys = false