Skip to content

Check that channel receive is used with result return variable #262

@fxedel

Description

@fxedel

Similarly to type assertions, channel receives val := <- ch can also be specified with another boolean result return value, val, ok := <-ch, indicating whether the channel is closed, i.e. whether val has actually been sent into the channel or it is just the zero value because the channel is closed.

I'd suggest that it makes sense checking this result to avoid working on invalid data. This linter could enforce this.

Similarly to type assertions, there should be a flag to disable the check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions