fix handling of embedded types inside unnamed types

This commit is contained in:
Nicolas S. Dade
2018-03-06 13:28:04 -08:00
parent 6334c0a320
commit 19a1ce64c0
+5 -1
View File
@@ -284,7 +284,11 @@ func (g *Generator) getType(t reflect.Type) string {
lines := make([]string, 0, nf)
for i := 0; i < nf; i++ {
f := t.Field(i)
line := f.Name + " " + g.getType(f.Type)
var line string
if !f.Anonymous {
line = f.Name + " "
} // else the field is anonymous (an embedded type)
line += g.getType(f.Type)
t := f.Tag
if t != "" {
line += " " + escapeTag(t)