francoispqt / gojay

high performance JSON encoder/decoder with stream API for Golang
MIT License
2.11k stars 113 forks source link

Problem decoding input if it starts with [ #129

Open xocasdashdash opened 4 years ago

xocasdashdash commented 4 years ago

So I have a process that's writing this to a file

[123] - A log message

When I try (and fail) to decode it using gojay like this:

err := dec.DecodeObject(lm)

The returned error is nil but the error in this file on this lines
(dec.err) show that it's an invalid input ("Cannot unmarshal JSON to type '*decoder.LogMessage'")

This generates an error in the error handling code because there's no error returned.