encoding/json: incorrect slice marshaling for slice of bytes implementing json.Marshaler #13783
encoding/json: Incorrect slice marshaling for slice of bytes implementing json.Marshaler:
Steps to reproduce:
Repeat with int, works as expected.
Code showing working cases and non-working case side-by-side: http://play.golang.org/p/5xgjl4e04R
System details: go1.5.1 / amd64
…coding CL 19725 changed the encoding of typedByte to look for typedByte.MarshalJSON and typedByte.MarshalText. Previously it was handled like byte, producing a base64 encoding of the underlying byte data. CL 19725 forgot to look for (*typedByte).MarshalJSON and (*typedByte).MarshalText, as the marshaling of other slices would. Add test and fix for those. This CL also adds tests that the decoder can handle both the old and new encodings. (This was true even in Go 1.6, which is the only reason we can consider this not an incompatible change.) For #13783. Change-Id: I7cab8b6c0154a7f2d09335b7fa23173bcf856c37 Reviewed-on: https://go-review.googlesource.com/23294 Reviewed-by: Ian Lance Taylor <firstname.lastname@example.org> Run-TryBot: Russ Cox <email@example.com> TryBot-Result: Gobot Gobot <firstname.lastname@example.org> Reviewed-by: Andrew Gerrand <email@example.com>