From a4f4632a3f934868012008d36eecafb912282d45 Mon Sep 17 00:00:00 2001 From: chavacava Date: Thu, 26 Jan 2023 22:50:35 +0100 Subject: [PATCH] fix #781 (#782) --- rule/nested-structs.go | 5 +++++ testdata/nested-structs.go | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/rule/nested-structs.go b/rule/nested-structs.go index 968511f2e..fd1226991 100644 --- a/rule/nested-structs.go +++ b/rule/nested-structs.go @@ -37,6 +37,11 @@ type lintNestedStructs struct { func (l *lintNestedStructs) Visit(n ast.Node) ast.Visitor { switch v := n.(type) { + case *ast.TypeSpec: + _, isInterface := v.Type.(*ast.InterfaceType) + if isInterface { + return nil // do not analyze interface declarations + } case *ast.FuncDecl: if v.Body != nil { ast.Walk(l, v.Body) diff --git a/testdata/nested-structs.go b/testdata/nested-structs.go index 8823d65ca..b1e1102b8 100644 --- a/testdata/nested-structs.go +++ b/testdata/nested-structs.go @@ -40,3 +40,8 @@ type Bad struct { type issue744 struct { c chan struct{} } + +// issue 781 +type mySetInterface interface { + GetSet() map[string]struct{} +}