aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/obj
diff options
context:
space:
mode:
authorJoe Tsai <joetsai@digital-static.net>2026-02-12 16:54:32 -0800
committerJoseph Tsai <joetsai@digital-static.net>2026-02-13 16:33:07 -0800
commitc186fe87686819cdf4dea49e1c556e9bc6e12e23 (patch)
tree6c238e55a442ec0a87ec048d9b04451898d01abc /src/cmd/internal/obj
parent9c9412cbad09ed7fc253de3ccfeea9ca18d22943 (diff)
downloadgo-c186fe87686819cdf4dea49e1c556e9bc6e12e23.tar.xz
encoding/json/v2: allow streaming JSON methods to return errors.ErrUnsupported
Allow the MarshalJSONTo and UnmarshalJSONFrom methods to return errors.ErrUnsupported to be skipped in a similar manner to how the caller-specified functions can be skipped as well. Note that the v1 MarshalJSON and UnmarshalJSON methods may not return errors.ErrUnsupported as that would be a breaking change. Also, we couldn't implement it for UnmarshalJSON since that requires consuming the value, which changes the state of the underlying jsontext.Decoder. A side-effect of this change is that MarshalJSONTo and UnmarshalJSONFrom methods may now return sentinel errors. We document that users should avoid calling this methods directly and instead rely on MarshalEncode and UnmarshalDecode, which can handle the ErrUnsupported sentinel error and others that we may add in the future. Fixes #74324 Fixes #76712 Change-Id: I851e907ef8d25e31964148515879a243cb5069c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/744941 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'src/cmd/internal/obj')
0 files changed, 0 insertions, 0 deletions