1
0
mirror of https://github.com/golang/go synced 2024-11-11 18:31:38 -07:00
go/src
Joe Tsai b817359249 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>
2017-07-22 01:29:58 +00:00
..
archive archive/zip: remove an out of date TODO 2017-07-15 21:14:01 +00:00
bufio Revert "bufio: make Reader.Peek invalidate Unreads" 2017-07-06 03:06:44 +00:00
builtin
bytes bytes: add example for (*Buffer).Grow 2017-07-16 03:49:43 +00:00
cmd cmd/go, cmd/link: if -no-pie doesn't work, try -nopie 2017-07-20 18:52:06 +00:00
compress
container
context
crypto crypto/x509: load all trusted certs on darwin (nocgo) 2017-07-14 18:47:10 +00:00
database/sql database/sql: fix wrong method name in description 2017-07-18 04:42:09 +00:00
debug
encoding encoding/json: ignore embedded fields of pointers to unexported non-structs 2017-07-22 01:29:58 +00:00
errors
expvar
flag
fmt
go ast: make ExampleCommentMap a runnable example 2017-07-16 01:43:40 +00:00
hash all: gofmt 2017-06-21 03:14:30 +00:00
html html/template: use the same escaper across multiple template executions 2017-07-14 18:19:04 +00:00
image
index/suffixarray
internal internal/poll: don't wait for unpollable files 2017-07-14 04:03:31 +00:00
io io/ioutil: add example for ReadFile 2017-07-15 23:28:44 +00:00
log log: adds a Logger Output method Example 2017-07-16 03:57:11 +00:00
math math/bits: add examples for leading zero methods 2017-07-15 21:55:58 +00:00
mime
net net/http: document that after Hijack, Request.Body is invalid 2017-07-21 18:55:41 +00:00
os os: remove duplicate check from windows os.Stat 2017-07-20 07:43:15 +00:00
path
plugin
reflect reflect: make StructOf panic for methods that don't work 2017-07-15 00:47:41 +00:00
regexp regexp: example for MatchString function 2017-07-15 21:13:35 +00:00
runtime runtime: improve out-of-memory message when VirtualAlloc fails 2017-07-21 01:00:33 +00:00
sort sort: add example for Strings 2017-07-15 23:17:23 +00:00
strconv strconv: apply Brad's review comment 2017-07-17 16:32:05 +00:00
strings strings: add a example for TrimFunc 2017-07-15 21:14:22 +00:00
sync sync: delete a sentence from the Map docs 2017-07-21 22:00:47 +00:00
syscall syscall: update check for UserNS support for centos 7 2017-07-17 18:18:08 +00:00
testing testing: roll back CL 44352 (show in-progress tests upon SIGINT) 2017-07-13 16:01:49 +00:00
text
time time: fix 400 years offset in comment 2017-07-17 15:38:46 +00:00
unicode
unsafe
vendor/golang_org/x
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash
make.bat
Make.dist
make.rc
naclmake.bash
nacltest.bash
race.bash
race.bat
run.bash
run.bat
run.rc