Skip to content

False positive on tests in go 1.22 / 1.21 w/ GOEXPERIMENT=loopvar #34

@pkwarren

Description

@pkwarren

In Go 1.22 (with GOEXPERIMENT=loopvar now the default), the Range statement for test <test> does not reinitialise the variable <var> linter is no longer accurate. If you take the example program linked from https://github.com/kunwardeep/paralleltest?tab=readme-ov-file#tparallel-is-called-in-the-range-method-and-test-case-variable-tc-being-used-but-is-not-reinitialised-more-info, you can see that it no longer reports incorrect output.

Is it possible to omit these warnings when running on Go 1.22+ or allow a mechanism to ignore these warnings?

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