From 4dca8b3e619a321de36b99b6b514d9c01ef76e5e Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Tue, 10 Feb 2026 11:34:35 -0800 Subject: encoding/json/v2: dual support errors.ErrUnsupported and SkipFunc This change supports both errors.ErrUnsupported and SkipFunc. In a future change, we will remove SkipFunc entirely in favor of using errors.ErrUnsupported, which exists for a similar pupose. Updates #74324 Change-Id: I5f1ada8e3914513d7d23c504f5965ca8dd95ad18 Reviewed-on: https://go-review.googlesource.com/c/go/+/745040 LUCI-TryBot-Result: Go LUCI Reviewed-by: Damien Neil Reviewed-by: Junyang Shao Reviewed-by: Johan Brandhorst-Satzkorn --- src/encoding/json/v2/example_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/encoding/json/v2/example_test.go') diff --git a/src/encoding/json/v2/example_test.go b/src/encoding/json/v2/example_test.go index 684ca9c6a2..b95ad0f73c 100644 --- a/src/encoding/json/v2/example_test.go +++ b/src/encoding/json/v2/example_test.go @@ -550,8 +550,8 @@ func ExampleWithUnmarshalers_rawNumber() { if dec.PeekKind() == '0' { *val = jsontext.Value(nil) } - // Return SkipFunc to fallback on default unmarshal behavior. - return json.SkipFunc + // Return ErrUnsupported to fallback on default unmarshal behavior. + return errors.ErrUnsupported }), )) if err != nil { @@ -604,8 +604,8 @@ func ExampleWithUnmarshalers_recordOffsets() { n := len(unread) - len(bytes.TrimLeft(unread, " \n\r\t,:")) tunnel.ByteOffset = dec.InputOffset() + int64(n) - // Return SkipFunc to fallback on default unmarshal behavior. - return json.SkipFunc + // Return ErrUnsupported to fallback on default unmarshal behavior. + return errors.ErrUnsupported }), )) if err != nil { -- cgit v1.3