Commit f30fa98 1 parent 99abd22 commit f30fa98 Copy full SHA for f30fa98
File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ func (p *Parser) parseStruct(spec *ast.TypeSpec) {
155
155
var s * ast.StructType
156
156
var ok bool
157
157
158
- if s , ok = spec .Type .(* ast.StructType ); ! ok {
158
+ if s , ok = spec .Type .(* ast.StructType ); ! ok {
159
159
return
160
160
}
161
161
@@ -173,13 +173,13 @@ func (p *Parser) parseStruct(spec *ast.TypeSpec) {
173
173
174
174
for _ , f := range s .Fields .List {
175
175
if f .Tag == nil || f .Tag .Value == "" {
176
- return
176
+ continue
177
177
}
178
178
179
179
tag , err := parseTags (f .Tag .Value )
180
180
181
181
if err != nil {
182
- return
182
+ continue
183
183
}
184
184
185
185
if tag .Type == "" {
@@ -207,6 +207,11 @@ func (p *Parser) parseTypeSpec(spec *ast.TypeSpec) {
207
207
p .parseStruct (spec )
208
208
case * ast.Ident :
209
209
t := parseType (spec .Type )
210
+
211
+ if spec .Name .Name == t {
212
+ return
213
+ }
214
+
210
215
p .tMtx .Lock ()
211
216
defer p .tMtx .Unlock ()
212
217
p .types = append (p .types , & TypeDef {
@@ -219,7 +224,7 @@ func (p *Parser) parseTypeSpec(spec *ast.TypeSpec) {
219
224
case * ast.SelectorExpr :
220
225
st := spec .Type .(* ast.SelectorExpr )
221
226
t := "any"
222
- if xv , ok := st .X .(* ast.Ident ); ! ok {
227
+ if xv , ok := st .X .(* ast.Ident ); ! ok {
223
228
panic ("unhandled case" )
224
229
} else {
225
230
p .pMtx .Lock ()
You can’t perform that action at this time.
0 commit comments