go-critic icon indicating copy to clipboard operation
go-critic copied to clipboard

lint: consider to add helper marker for functions in test files

Open cristaloleg opened this issue 7 years ago • 1 comments

before:

// code_test.go
func testHelper(t *testing.T, params ...interface{}) interface{} {
    ...
}

after:

// code_test.go
func testHelper(t *testing.T, params ...interface{}) interface{} {
    t.Helper()
    ...
}

This will exclude noisy(?) testHelper from a stacktrace.

cristaloleg avatar Jun 12 '18 21:06 cristaloleg

Covered by https://golangci-lint.run/usage/linters/#thelper

Antonboom avatar Oct 12 '23 20:10 Antonboom