Descriptionreflect: fixed bug introduced with change 66510044.
A struct may contain embedded unexported structs which, in turn, contains
exported fields. According to the Go spec, fields that are promoted from an
embedded struct are treated as ordinary fields. So exported fields in such
a struct should be exported in the embedding struct as well. Go handles
this correctly. The reflect package should and did handle this analoguously.
The aforementioned change broke this. The changes in this CL to the reflect
package fix this again. CanSet will still be false for a anonymous field
with an unexported struct, but it will be true for values of exported fields
within such a struct.
This change also changed the semantics of PkgPath. Several packages relied
on PkgPath != "" to mean that a field no longer needs to be searched for
unexported fields. This is no longer the case. This CL includes fixes for
the xml and json package. I didn't see similar cases in core, but I suspect
there are others out there.
Fixes Issue 7522.
Patch Set 1 #Patch Set 2 : diff -r 6c0339d94123 https://code.google.com/p/go #Patch Set 3 : diff -r 321d42ff40d3 https://code.google.com/p/go #Patch Set 4 : diff -r 321d42ff40d3 https://code.google.com/p/go #
Total comments: 4
Patch Set 5 : diff -r 0134c7020c40 https://code.google.com/p/go #Patch Set 6 : diff -r 0134c7020c40 https://code.google.com/p/go #
MessagesTotal messages: 13
|