]> Cypherpunks repositories - gostls13.git/commit
encoding/json: fix truncated Token error regression in goexperiment.jsonv2
authorJoe Tsai <joetsai@digital-static.net>
Fri, 25 Jul 2025 00:10:54 +0000 (17:10 -0700)
committerGopher Robot <gobot@golang.org>
Fri, 25 Jul 2025 17:48:56 +0000 (10:48 -0700)
commitc76c3abc5426ab3d183514c834bcd7d6a653ae89
treecb75706e042625e3106054505384120f39792936
parentebdbfccd989b07a8aef75af5fbe7448f035ee239
encoding/json: fix truncated Token error regression in goexperiment.jsonv2

The jsontext.Decoder.ReadToken method reports a non-EOF error,
if the token stream is truncated and does not form a valid JSON value.
In contrast, the v1 json.Decoder.Token method would report EOF
so long as the input was a prefix of some valid JSON value.
Modify json.Decoder.Token to preserve historical behavior.

This only modifies code that is compiled in under goexperiment.jsonv2.

Updates #69449
Fixes #74750

Change-Id: Ifd281c46f118f0e748076013fefc7659f77c56ed
Reviewed-on: https://go-review.googlesource.com/c/go/+/689516
Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
src/encoding/json/stream_test.go
src/encoding/json/v2_stream.go
src/encoding/json/v2_stream_test.go