mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
encoding/json: revert "add "json: " prefix to SyntaxError messages"
This reverts commit 6af088bfc6.
Reason for revert: Broke many tests inside Google which implies many
tests were broken outside of Google as well. The tests may be brittle
but still would require work to change and it's not clear it's worth
the benefit.
Updates #36221
Fixes #42675
Change-Id: Id3a14eb37e7119f5abe50e80dfbf120fdc44db72
Reviewed-on: https://go-review.googlesource.com/c/go/+/273747
Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Trust: Joe Tsai <thebrokentoaster@gmail.com>
This commit is contained in:
parent
7fca39aa05
commit
283d65413d
5 changed files with 5 additions and 11 deletions
|
|
@ -454,12 +454,6 @@ Do not send CLs removing the interior tags from such phrases.
|
|||
|
||||
<dl id="encoding/json"><dt><a href="/pkg/encoding/json/">encoding/json</a></dt>
|
||||
<dd>
|
||||
<p><!-- CL 263619 -->
|
||||
The error message for
|
||||
<a href="/pkg/encoding/json/#SyntaxError">SyntaxError</a>
|
||||
now begins with "json: ", matching the other errors in the package.
|
||||
</p>
|
||||
|
||||
<p><!-- CL 234818 -->
|
||||
TODO: <a href="https://golang.org/cl/234818">https://golang.org/cl/234818</a>: allow semicolon in field key / struct tag
|
||||
</p>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ env GO111MODULE=on
|
|||
env GOPROXY=$GOPROXY/invalid
|
||||
|
||||
! go list -m rsc.io/quote@latest
|
||||
stderr '^go list -m: module rsc.io/quote: invalid response from proxy "'$GOPROXY'": json: invalid character ''i'' looking for beginning of value$'
|
||||
stderr '^go list -m: module rsc.io/quote: invalid response from proxy "'$GOPROXY'": invalid character ''i'' looking for beginning of value$'
|
||||
|
||||
! go list -m rsc.io/quote@1.5.2
|
||||
stderr '^go list -m: rsc.io/quote@1.5.2: invalid version: invalid response from proxy "'$GOPROXY'": json: invalid character ''i'' looking for beginning of value$'
|
||||
stderr '^go list -m: rsc.io/quote@1.5.2: invalid version: invalid response from proxy "'$GOPROXY'": invalid character ''i'' looking for beginning of value$'
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ env GOPROXY=file:///$WORK/gatekeeper
|
|||
chmod 0000 $WORK/gatekeeper/example.com/join/subpkg/@latest
|
||||
cp go.mod.orig go.mod
|
||||
! go get -d example.com/join/subpkg
|
||||
stderr 'go get: module example.com/join/subpkg: (invalid response from proxy ".+": json: invalid character .+|reading file://.*/gatekeeper/example.com/join/subpkg/@latest: .+)'
|
||||
stderr 'go get: module example.com/join/subpkg: (invalid response from proxy ".+": invalid character .+|reading file://.*/gatekeeper/example.com/join/subpkg/@latest: .+)'
|
||||
|
||||
-- go.mod.orig --
|
||||
module example.com/othermodule
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ type SyntaxError struct {
|
|||
Offset int64 // error occurred after reading Offset bytes
|
||||
}
|
||||
|
||||
func (e *SyntaxError) Error() string { return "json: " + e.msg }
|
||||
func (e *SyntaxError) Error() string { return e.msg }
|
||||
|
||||
// A scanner is a JSON scanning state machine.
|
||||
// Callers call scan.reset and then pass bytes in one at a time
|
||||
|
|
|
|||
|
|
@ -243,7 +243,7 @@ func TestEscape(t *testing.T) {
|
|||
{
|
||||
"badMarshaler",
|
||||
`<button onclick='alert(1/{{.B}}in numbers)'>`,
|
||||
`<button onclick='alert(1/ /* json: error calling MarshalJSON for type *template.badMarshaler: json: invalid character 'f' looking for beginning of object key string */null in numbers)'>`,
|
||||
`<button onclick='alert(1/ /* json: error calling MarshalJSON for type *template.badMarshaler: invalid character 'f' looking for beginning of object key string */null in numbers)'>`,
|
||||
},
|
||||
{
|
||||
"jsMarshaler",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue