]> Cypherpunks repositories - gostls13.git/commitdiff
encoding/json: revert "add "json: " prefix to SyntaxError messages"
authorKevin Burke <kev@inburke.com>
Fri, 27 Nov 2020 21:55:27 +0000 (13:55 -0800)
committerJoe Tsai <thebrokentoaster@gmail.com>
Tue, 1 Dec 2020 22:51:45 +0000 (22:51 +0000)
This reverts commit 6af088bfc66c13143c9ef46b4cf0805df77a8fbe.

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>

doc/go1.16.html
src/cmd/go/testdata/script/mod_proxy_invalid.txt
src/cmd/go/testdata/script/mod_query_empty.txt
src/encoding/json/scanner.go
src/html/template/escape_test.go

index 0c1fe5b381310658dd0ee9c95dad863e7966805d..ffdbc97c62b5e909cfe88941c488fd05affe8659 100644 (file)
@@ -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>
index b9418b4df1215f1d210651e5ca1842c1396abce8..6427cc1527af3793236f9e42d4f5c31acc17514e 100644 (file)
@@ -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$'
index 1f13d7ad693e901ebf1121487794197b4c37a774..f8b6e3e97edcff1c2c2d2ec0abadb5b3d3bc04b4 100644 (file)
@@ -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
index c3f5f6372db6376e90dd526e2ab5e092d36ae578..9dc1903e2db24b17d90ab90fb8de930131adb336 100644 (file)
@@ -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
index b6031ea60ac07cb0f27b2f7be367ac2ffcc0f377..fbc84a75928b23077a2925598f472839c23b0fdd 100644 (file)
@@ -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 &#39;f&#39; looking for beginning of object key string */null in numbers)'>`,
+                       `<button onclick='alert(1/ /* json: error calling MarshalJSON for type *template.badMarshaler: invalid character &#39;f&#39; looking for beginning of object key string */null in numbers)'>`,
                },
                {
                        "jsMarshaler",