From 82ecbe2f4de50dce71926baf93645f54bc676e97 Mon Sep 17 00:00:00 2001 From: chavacava Date: Sat, 3 Sep 2022 07:10:12 +0000 Subject: [PATCH] fix #744 --- 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 b4f7352db..968511f2e 100644 --- a/rule/nested-structs.go +++ b/rule/nested-structs.go @@ -43,6 +43,11 @@ func (l *lintNestedStructs) Visit(n ast.Node) ast.Visitor { } return nil case *ast.Field: + _, isChannelField := v.Type.(*ast.ChanType) + if isChannelField { + return nil + } + filter := func(n ast.Node) bool { switch n.(type) { case *ast.StructType: diff --git a/testdata/nested-structs.go b/testdata/nested-structs.go index 7e5abafaf..8823d65ca 100644 --- a/testdata/nested-structs.go +++ b/testdata/nested-structs.go @@ -35,3 +35,8 @@ func fred() interface{} { type Bad struct { Field []struct{} // MATCH /no nested structs are allowed/ } + +// issue744 +type issue744 struct { + c chan struct{} +}