Skip to content

AvoidChannelLenCheck false match #12

Description

@greg-at-moderne

Steps to reproduce

func TestAvoidChannelLenCheckNoChangeSlice(t *testing.T) {
    spec := test.NewRecipeSpec().WithRecipe(&simplification.AvoidChannelLenCheck{})
    spec.RewriteRun(t,
        test.Golang(`
            package main

            func f(s []int) bool {
                return len(s) == 0
            }
        `),
    )
}

as in avoid_channel_len_check_test.go

Expected

No marker attached.

Observed

return/*~~(channel length check is racy; the value can change between check and send/receive)~~>*/ len(s) == 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions