From 770864f3b452dbd83e33e42b9659c387d03425b9 Mon Sep 17 00:00:00 2001 From: Joe Tsai Date: Thu, 12 Feb 2026 10:42:52 -0800 Subject: encoding/json/v2: remove SkipFunc sentinel error WARNING: This commit contains breaking changes for those already using GOEXPERIMENT=jsonv2. Existing users of SkipFunc should migrate to errors.ErrUnsupported, for which support was added in at least one prior commit. Updates #74324 Change-Id: Ifbdee39165a134a33ea0005bbc88df0df15f517f Reviewed-on: https://go-review.googlesource.com/c/go/+/745041 LUCI-TryBot-Result: Go LUCI Reviewed-by: Ethan Lee Reviewed-by: Damien Neil Auto-Submit: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Reviewed-by: Dmitri Shuralyov Reviewed-by: Nicholas Husin --- src/encoding/json/v2/arshal_funcs.go | 11 ----------- src/encoding/json/v2/example_test.go | 1 + 2 files changed, 1 insertion(+), 11 deletions(-) (limited to 'src/encoding') diff --git a/src/encoding/json/v2/arshal_funcs.go b/src/encoding/json/v2/arshal_funcs.go index 1c325b16cb..860ff0b0f2 100644 --- a/src/encoding/json/v2/arshal_funcs.go +++ b/src/encoding/json/v2/arshal_funcs.go @@ -19,17 +19,6 @@ import ( "encoding/json/jsontext" ) -// SkipFunc may be returned by [MarshalToFunc] and [UnmarshalFromFunc] functions. -// -// Any function that returns SkipFunc must not cause observable side effects -// on the provided [jsontext.Encoder] or [jsontext.Decoder]. -// For example, it is permissible to call [jsontext.Decoder.PeekKind], -// but not permissible to call [jsontext.Decoder.ReadToken] or -// [jsontext.Encoder.WriteToken] since such methods mutate the state. -// -// Deprecated: Use [errors.ErrUnsupported] instead. -var SkipFunc = errors.ErrUnsupported - var errUnsupportedMutation = errors.New("unsupported calls must not read or write any tokens") var errNonSingularValue = errors.New("must read or write exactly one value") diff --git a/src/encoding/json/v2/example_test.go b/src/encoding/json/v2/example_test.go index b95ad0f73c..f8b42ce3de 100644 --- a/src/encoding/json/v2/example_test.go +++ b/src/encoding/json/v2/example_test.go @@ -8,6 +8,7 @@ package json_test import ( "bytes" + "errors" "fmt" "log" "math" -- cgit v1.3