chore: refactor goctl api (#3605)

This commit is contained in:
Kevin Wan
2023-10-07 22:58:29 +08:00
committed by GitHub
parent 02c95108b9
commit ff230c4b1d
2 changed files with 18 additions and 7 deletions

View File

@@ -174,14 +174,15 @@ func (p parser) findDefinedType(name string) (*spec.Type, error) {
}
func (p parser) fieldToMember(field *ast.TypeField) spec.Member {
name := ""
tag := ""
var name string
var tag string
if !field.IsAnonymous {
name = field.Name.Text()
if field.Tag != nil {
tag = field.Tag.Text()
}
}
return spec.Member{
Name: name,
Type: p.astTypeToSpec(field.DataType),