Skip to content

golangci-lint: Add the `thelper` linter to enforce more-consistent test style

Patrick Steinhardt requested to merge pks-golangci-lint-thelper into master

This MR adds the thelper linter to enforce a more-consistent test style:

  • testing.T et al should be the first parameter. We don't fully enforce this given that context.Context may still be the first parameter right now.
  • testing.T, testing.B and testing.TB variables should be called t, b and tb, respectively.

Ideally, we'd also enable the linter for missing t.Helper() calls. But as it is right now I find it rather useless as it flags too many locations as missing those calls.

Merge request reports