Skip to content

Commit

Permalink
fix #744 (#746)
Browse files Browse the repository at this point in the history
  • Loading branch information
chavacava authored Sep 5, 2022
1 parent 553604e commit 7c2ebbd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rule/nested-structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions testdata/nested-structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
}

0 comments on commit 7c2ebbd

Please sign in to comment.