]> Cypherpunks repositories - gostls13.git/commit
encoding/json: add Path to UnmarshalTypeError
authorLE Manh Cuong <cuong.manhle.vn@gmail.com>
Sat, 27 Oct 2018 18:44:09 +0000 (01:44 +0700)
committerDaniel Martí <mvdan@mvdan.cc>
Tue, 5 Mar 2019 12:34:11 +0000 (12:34 +0000)
commit29bc4f12581d836a96139c924f16a4987324edd1
treecb26fdd26ae6dc3d13c9fe706643827d930c7371
parent95d4e6158b4199e1eee957e2c8c934d2cb86c35e
encoding/json: add Path to UnmarshalTypeError

When parsing nested object, UnmarshalTypeError does not contain actual
path to nested field in original JSON.

This commit change Field to contain the full path to that field. One
can get the Field name by stripping all the leading path elements.

Fixes #22369

Change-Id: I6969cc08abe8387a351e3fb2944adfaa0dccad2a
Reviewed-on: https://go-review.googlesource.com/c/go/+/145218
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/encoding/json/decode.go
src/encoding/json/decode_test.go