aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/encode.go
diff options
context:
space:
mode:
authorDamien Neil <dneil@google.com>2020-09-14 21:00:52 +0000
committerDamien Neil <dneil@google.com>2020-09-14 21:33:20 +0000
commit114719e16e9681bd1001326598ededa719c17944 (patch)
tree0773ea1d3d97233585db743c95c5f76247d60969 /src/encoding/json/encode.go
parenta408139bb0166f6e0a5d9fd17fc934da960c354e (diff)
downloadgo-114719e16e9681bd1001326598ededa719c17944.tar.xz
Revert "encoding/json: implement Is on all errors"
This reverts CL 254537. Reason for revert: Reason for revert: The recommended way to check for a type of error is errors.As. API changes should also start with a proposal. Change-Id: I07c37428575e99c80b17525833a61831d10963bb Reviewed-on: https://go-review.googlesource.com/c/go/+/254857 Trust: Damien Neil <dneil@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Diffstat (limited to 'src/encoding/json/encode.go')
-rw-r--r--src/encoding/json/encode.go12
1 files changed, 0 insertions, 12 deletions
diff --git a/src/encoding/json/encode.go b/src/encoding/json/encode.go
index 8e6b342b59..578d551102 100644
--- a/src/encoding/json/encode.go
+++ b/src/encoding/json/encode.go
@@ -245,12 +245,6 @@ func (e *UnsupportedValueError) Error() string {
return "json: unsupported value: " + e.Str
}
-// Is returns true if target is a UnsupportedValueError.
-func (e *UnsupportedValueError) Is(target error) bool {
- _, ok := target.(*UnsupportedValueError)
- return ok
-}
-
// Before Go 1.2, an InvalidUTF8Error was returned by Marshal when
// attempting to encode a string value with invalid UTF-8 sequences.
// As of Go 1.2, Marshal instead coerces the string to valid UTF-8 by
@@ -285,12 +279,6 @@ func (e *MarshalerError) Error() string {
// Unwrap returns the underlying error.
func (e *MarshalerError) Unwrap() error { return e.Err }
-// Is returns true if target is a MarshalerError.
-func (e *MarshalerError) Is(target error) bool {
- _, ok := target.(*MarshalerError)
- return ok
-}
-
var hex = "0123456789abcdef"
// An encodeState encodes JSON into a bytes.Buffer.