Merge pull request #122 from danw/structof

Support structures built with StructOf
This commit is contained in:
Dan Willemsen 2016-09-09 13:24:50 -07:00 committed by GitHub
commit f5909d9cb5

View file

@ -128,6 +128,15 @@ func unpackStructValue(namePrefix string, structValue reflect.Value,
fieldValue := structValue.Field(i)
field := structType.Field(i)
// In Go 1.7, runtime-created structs are unexported, so it's not
// possible to create an exported anonymous field with a generated
// type. So workaround this by special-casing "BlueprintEmbed" to
// behave like an anonymous field for structure unpacking.
if field.Name == "BlueprintEmbed" {
field.Name = ""
field.Anonymous = true
}
if field.PkgPath != "" {
// This is an unexported field, so just skip it.
continue