go/src/encoding
Daniel Martí 13327f219e encoding/json: obey SetEscapeHTML in all MarshalJSON cases
It wasn't obeyed in the case where the MarshalJSON method uses a pointer
receiver, and the encoder grabs the address of a value to find that
method. addrMarshalerEncoder is the function that does this work, but it
ignored opts.escapeHTML.

Here's the before and after of the added test case, which was failing
before the fix. Now the two cases are correct and consistent.

	{"NonPtr":"<str>","Ptr":"\u003cstr\u003e"}
	{"NonPtr":"<str>","Ptr":"<str>"}

Fixes #32896.

Change-Id: Idc53077ece074973558bd3bb5ad036380db0d02c
Reviewed-on: https://go-review.googlesource.com/c/go/+/184757
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
Reviewed-by: Caleb Spare <cespare@gmail.com>
2019-07-06 13:25:59 +00:00
..
ascii85
asn1 all: use "reports whether" consistently in the few places that didn't 2018-11-02 22:47:58 +00:00
base32 all: simplify code using "gofmt -s -w" 2019-05-06 22:19:22 +00:00
base64 encoding/base64: speed up the decoder 2019-03-13 10:39:58 +00:00
binary all: simplify code using "gofmt -s -w" 2019-05-06 22:19:22 +00:00
csv all: add Unwrap and Is methods to various error types 2019-05-04 16:14:12 +00:00
gob encoding/gob: properly ignore errors 2019-05-22 20:42:35 +00:00
hex encoding/hex: simplify encoder arithmetic 2019-03-05 17:40:09 +00:00
json encoding/json: obey SetEscapeHTML in all MarshalJSON cases 2019-07-06 13:25:59 +00:00
pem all: remove PEM-encoded private keys from tests 2019-05-21 20:03:55 +00:00
xml encoding/xml, encoding/json: docs and examples using custom marshalers 2018-12-12 14:18:06 +00:00
encoding.go