aboutsummaryrefslogtreecommitdiff
path: root/src/encoding/xml/typeinfo.go
diff options
context:
space:
mode:
authorMarcel van Lohuizen <mpvl@golang.org>2015-08-28 10:21:45 +0200
committerMarcel van Lohuizen <mpvl@golang.org>2015-10-26 11:26:11 +0000
commit34f04a675c204dc00f2ae1bc412e474b9a4c087d (patch)
treecbd3971b5d8eb5db063303c915396555756ea975 /src/encoding/xml/typeinfo.go
parenta30dd9ceeb2fb2361cd5a4ae623258ec0a96c517 (diff)
downloadgo-34f04a675c204dc00f2ae1bc412e474b9a4c087d.tar.xz
encoding/xml: check for exported fields in embedded structs
Addresses issue #12367. Must be checked in before CL 14010. Change-Id: I4523a1de112ed02371504e27882659bce8028a9f Reviewed-on: https://go-review.googlesource.com/14012 Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/encoding/xml/typeinfo.go')
-rw-r--r--src/encoding/xml/typeinfo.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/encoding/xml/typeinfo.go b/src/encoding/xml/typeinfo.go
index 22248d20a6..6766b88f09 100644
--- a/src/encoding/xml/typeinfo.go
+++ b/src/encoding/xml/typeinfo.go
@@ -60,7 +60,7 @@ func getTypeInfo(typ reflect.Type) (*typeInfo, error) {
n := typ.NumField()
for i := 0; i < n; i++ {
f := typ.Field(i)
- if f.PkgPath != "" || f.Tag.Get("xml") == "-" {
+ if (f.PkgPath != "" && !f.Anonymous) || f.Tag.Get("xml") == "-" {
continue // Private field
}