nicolasdilley / Gomela

Tool developped for "Bounded verification of message passing concurrency in Go programs."
39 stars 7 forks source link

Channel assigned to a field of a stuct should result in a model error #9

Open nicolasdilley opened 3 years ago

nicolasdilley commented 3 years ago

https://github.com/github/git-sizer/blob/951a51bd37e5e3454850d471b05d9d51d4851b74/git/git.go#L445

A common pattern is to assign a channel to a field of a struct and either call a method on the struct which affects the channel in some way or returning the struct.

Potential fix:

check if the channel is used on the right side of an AssignStmt or a DeclStmt via a simple Ident and check if the left handside is a SelectorExpr or a CompositeList . If it is just return a parseError