Skip to content

x/tools/go/analysis/analysistest: adding a test file to test-data package breaks RunWithSuggestedFixes #40574

@benjaminjkraft

Description

@benjaminjkraft

Suppose you run analysistest.Run on a package with a test file (say to test test-specific behavior of the analyzer). What apparently happens is that analysistest calls the analyzer once on the package without its tests, and once on the package with its tests. This is not a big deal; you get some duplicate error messages.

But now suppose you instead run analysistest.RunWithSuggestedFixes. In this case, analysistest ends up combining the fixes from both runs. This means you get all your fixes applied twice, which surely doesn't match your .golden file! it's a very confusing error.

A workaround is to change the test file to mypackage_test, such that the two runs will be entirely disjoint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions