diff options
author | Joe Tsai <joetsai@digital-static.net> | 2017-07-21 16:53:54 -0700 |
---|---|---|
committer | Joe Tsai <joetsai@google.com> | 2017-07-22 01:29:58 +0000 |
commit | b81735924936291303559fd71dabaa1aa88f57c5 (patch) | |
tree | f429ab3c9ed7612f1781bc1305635cb622230904 /.github | |
parent | 5f7a03e148b9a37f2c61f7d428abc6b360897a0c (diff) | |
download | go-b81735924936291303559fd71dabaa1aa88f57c5.tar.gz go-b81735924936291303559fd71dabaa1aa88f57c5.zip |
encoding/json: ignore embedded fields of pointers to unexported non-structs
https://golang.org/cl/33773 fixes the JSON marshaler to avoid serializing
embedded fields on unexported types of non-struct types. However, Go allows
embedding pointer to types, so the check for whether the field is a non-struct
type must first dereference the pointer to get at the underlying type.
Furthermore, due to a edge-case in the behavior of StructField.PkgPath not
being a reliable indicator of whether the field is unexported (see #21122),
we use our own logic to determine whether the field is exported or not.
The logic in this CL may be simplified depending on what happens in #21122.
Fixes #21121
Updates #21122
Change-Id: I8dfd1cdfac8a87950df294a566fb96dfd04fd749
Reviewed-on: https://go-review.googlesource.com/50711
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to '.github')
0 files changed, 0 insertions, 0 deletions