Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gaojingyu committed Feb 7, 2021
1 parent cfe4005 commit bf712af
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cmd/structcheck/structcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ func (v *visitor) typeAndFieldName(expr *ast.SelectorExpr) (types.Type, string,
if ptr, ok := recv.(*types.Pointer); ok {
recv = ptr.Elem()
}
for _, idx := range selection.Index()[:len(selection.Index())-1] {
recv = recv.Underlying().(*types.Struct).Field(idx).Type()
}

return recv, selection.Obj().Name(), true
}

Expand Down

0 comments on commit bf712af

Please sign in to comment.