mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 13:12:05 -05:00
Check for exported fields in embedded structs
This fixes a exported field check condition in a way described at Go issue https://golang.org/issue/12367 According to the issue comments, this fix should be safe under Go 1.6.
This commit is contained in:
parent
12876ec991
commit
3b3e771d61
1 changed files with 1 additions and 1 deletions
|
@ -588,7 +588,7 @@ func evaluateSubElem(obj reflect.Value, elemName string) (reflect.Value, error)
|
||||||
case reflect.Struct:
|
case reflect.Struct:
|
||||||
ft, ok := obj.Type().FieldByName(elemName)
|
ft, ok := obj.Type().FieldByName(elemName)
|
||||||
if ok {
|
if ok {
|
||||||
if ft.PkgPath != "" {
|
if ft.PkgPath != "" && !ft.Anonymous {
|
||||||
return zero, fmt.Errorf("%s is an unexported field of struct type %s", elemName, typ)
|
return zero, fmt.Errorf("%s is an unexported field of struct type %s", elemName, typ)
|
||||||
}
|
}
|
||||||
return obj.FieldByIndex(ft.Index), nil
|
return obj.FieldByIndex(ft.Index), nil
|
||||||
|
|
Loading…
Reference in a new issue