mirror of
https://github.com/golang/go.git
synced 2025-11-10 05:31:03 +00:00
encoding/json: disable anonymous fields
We should, after Go 1, make them work the same as package xml, that is, make them appear in the outer struct. For now turn them off so that people do not depend on the old behavior. Fixing them is issue 3069. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5656102
This commit is contained in:
parent
89b075cc90
commit
990f9f4c00
3 changed files with 48 additions and 0 deletions
|
|
@ -538,6 +538,11 @@ func encodeFields(t reflect.Type) []encodeField {
|
|||
if f.PkgPath != "" {
|
||||
continue
|
||||
}
|
||||
if f.Anonymous {
|
||||
// We want to do a better job with these later,
|
||||
// so for now pretend they don't exist.
|
||||
continue
|
||||
}
|
||||
var ef encodeField
|
||||
ef.i = i
|
||||
ef.tag = f.Name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue