• Joe Tsai's avatar
    encoding/json: ignore embedded fields of pointers to unexported non-structs · b8173592
    Joe Tsai authored
    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/50711Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    b8173592
Name
Last commit
Last update
..
testdata Loading commit data...
bench_test.go Loading commit data...
decode.go Loading commit data...
decode_test.go Loading commit data...
encode.go Loading commit data...
encode_test.go Loading commit data...
example_marshaling_test.go Loading commit data...
example_test.go Loading commit data...
fold.go Loading commit data...
fold_test.go Loading commit data...
indent.go Loading commit data...
number_test.go Loading commit data...
scanner.go Loading commit data...
scanner_test.go Loading commit data...
stream.go Loading commit data...
stream_test.go Loading commit data...
tables.go Loading commit data...
tagkey_test.go Loading commit data...
tags.go Loading commit data...
tags_test.go Loading commit data...