decoder: handle private anonymous structs

Ref #508
This commit is contained in:
Thomas Pelletier
2021-04-15 12:49:24 -04:00
parent 080baa8574
commit b86b890b8d
2 changed files with 19 additions and 4 deletions
+3 -4
View File
@@ -516,11 +516,10 @@ func scopeStruct(v reflect.Value, name string) (target, bool, error) {
l := len(path)
path = append(path, i)
f := t.Field(i)
if f.PkgPath != "" {
// only consider exported fields
} else if f.Anonymous {
if f.Anonymous {
walk(v.Field(i))
} else {
} else if f.PkgPath == "" {
// only consider exported fields
fieldName, ok := f.Tag.Lookup("toml")
if !ok {
fieldName = f.Name