Skip to content

golangci: whitelist common test patterns

Follow-up 149d5611 (golangci: fix linting issues on "master", 2020-12-24) and exempt common patterns in our tests that newly added tests are very likely to run afoul of. See [1] for such a failure.

The common pattern is seen in the diff to tags_test.go here. The standard boilerplate is to call newOperationClient()'s teardown like that, and the context lint is warning about a widely used function added in e87b76da (featureset: Simplify execution with a new Run() function, 2020-11-03).

Maybe we'd like to clean those up, but let's do that all in one MR, not by prodding every author of a new test copying established pattern to fix this for their new test.

Before this if the revision limitation in 20ef2643 (golangci: Enable error and documentation linters, 2020-12-17) is removed we'd emit 1369 issues under "make lint", now it would be 831. Of those 831 we've got 431 emitted from *_test.go files.

Perhaps we'd like to be more permissive still, but by my skimming most of the new ones make sense, e.g. warning about exec.Command[...].Run() return values not being checked.

  1. https://gitlab.com/gitlab-org/gitaly/-/pipelines/234007367/failures

Merge request reports