From 7c2ebbda241715a423877aadc531d0fc03625f0d Mon Sep 17 00:00:00 2001 From: chavacava Date: Mon, 5 Sep 2022 11:11:45 +0200 Subject: [PATCH] fix #744 (#746) --- 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{} +}