aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/json/v2/example_test.go
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2026-02-10 11:34:35 -0800
committerJoseph Tsai <joetsai@digital-static.net>2026-02-13 11:58:39 -0800
commit4dca8b3e619a321de36b99b6b514d9c01ef76e5e (patch)
treef15a3910c432793d34fe65f4ea7fbb1416239a53 /src/encoding/json/v2/example_test.go
parent4f5d5ddf7c79305cc49c777efa3c365dd58f34df (diff)
downloadgo-4dca8b3e619a321de36b99b6b514d9c01ef76e5e.tar.xz
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
Diffstat (limited to 'src/encoding/json/v2/example_test.go')
-rw-r--r--src/encoding/json/v2/example_test.go8
1 files changed, 4 insertions, 4 deletions
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 {