From bf712af3793f551363aa310bf7224db2f4a6f0c9 Mon Sep 17 00:00:00 2001 From: gaojingyu Date: Sun, 7 Feb 2021 21:08:37 +0800 Subject: [PATCH] fix --- cmd/structcheck/structcheck.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/structcheck/structcheck.go b/cmd/structcheck/structcheck.go index 5dc5f83..385127b 100644 --- a/cmd/structcheck/structcheck.go +++ b/cmd/structcheck/structcheck.go @@ -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 }