diff options
author | Kevin Burke <kev@inburke.com> | 2020-10-19 13:29:40 -0700 |
---|---|---|
committer | Kevin Burke <kev@inburke.com> | 2020-10-21 18:50:01 +0000 |
commit | 6af088bfc66c13143c9ef46b4cf0805df77a8fbe (patch) | |
tree | 0fde5c9608b15b0511812d165856204970046af0 /src/encoding | |
parent | 612a363bef9ae29d190f6daa2a5a1623f78c874b (diff) | |
download | go-6af088bfc66c13143c9ef46b4cf0805df77a8fbe.tar.gz go-6af088bfc66c13143c9ef46b4cf0805df77a8fbe.zip |
encoding/json: add "json: " prefix to SyntaxError messages
The other named errors - UnmarshalTypeError, etc - in this package do
the same, so we should prepend the package prefix to error messages
for consistency.
Add a note to the release docs in case this is interpreted as
a breaking change.
Fixes #36221.
Change-Id: Ie24b532bbf9812e108c259fa377e2a6b64319ed4
Reviewed-on: https://go-review.googlesource.com/c/go/+/263619
Run-TryBot: Kevin Burke <kev@inburke.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Kevin Burke <kev@inburke.com>
Trust: Daniel Martà <mvdan@mvdan.cc>
Reviewed-by: Daniel Martà <mvdan@mvdan.cc>
Diffstat (limited to 'src/encoding')
-rw-r--r-- | src/encoding/json/scanner.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/encoding/json/scanner.go b/src/encoding/json/scanner.go index 9dc1903e2d..c3f5f6372d 100644 --- a/src/encoding/json/scanner.go +++ b/src/encoding/json/scanner.go @@ -47,7 +47,7 @@ type SyntaxError struct { Offset int64 // error occurred after reading Offset bytes } -func (e *SyntaxError) Error() string { return e.msg } +func (e *SyntaxError) Error() string { return "json: " + e.msg } // A scanner is a JSON scanning state machine. // Callers call scan.reset and then pass bytes in one at a time |