hugo

Unnamed repository; edit this file 'description' to name the repository.

git clone git://git.shimmy1996.com/hugo.git
commit 3b3e771d613b3d8b9c54bc8b42e4bae7ba0bbb68
parent 12876ec991982de27773d127e2030b1eeb2826b2
Author: Tatsushi Demachi <tdemachi@gmail.com>
Date:   Thu, 28 Jan 2016 19:27:35 +0900

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.

Diffstat:
Mtpl/template_funcs.go | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tpl/template_funcs.go b/tpl/template_funcs.go
@@ -588,7 +588,7 @@ func evaluateSubElem(obj reflect.Value, elemName string) (reflect.Value, error) 
 	case reflect.Struct:
 		ft, ok := obj.Type().FieldByName(elemName)
 		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 obj.FieldByIndex(ft.Index), nil