Merge pull request #115 from cloudskiff/fix_analyzer

Fix a weakness in analyzer
main
Elie 2021-01-14 18:20:28 +01:00 committed by GitHub
commit 246a46b0b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ func (a Analyzer) getField(t reflect.Type, path []string) (reflect.StructField,
return a.getField(t.Elem(), path[1:])
default:
{
if field, ok := t.FieldByName(path[0]); ok && a.hasNestedFields(field.Type) {
if field, ok := t.FieldByName(path[0]); ok && a.hasNestedFields(field.Type) && len(path) > 1 {
return a.getField(field.Type, path[1:])
} else {
return field, ok