Skip to content

False positive: test functions that are not helpers trigger an issue [generics] #54

Description

@fredbi

Here is a sample code that triggers a thelper issue.

Arguably this is not a helper: this is an unexported test function and I am okay to have all the detailed line numbers reported
with any failure inside this function. It looks like since I've adopted generics in my test suites, the thelper check raises a lot of
false positives.

Please advise.

version: v0.71. (via golangci-lint)
go version go1.25.5 linux/amd64

//nolint:thelper // false positive: this is not a helper
func testAllMarshalAs[Doc Text, Object any](value Object, jazon Doc, success bool) func(*testing.T) {
        return func(t *testing.T) {
                t.Run("with JSONMarshalAsT", testJSONMarshalAsT(value, jazon, success))

                t.Run("with JSONUnmarshalAsT", testJSONUnmarshalAsT(value, jazon, success))
        }
}

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