Skip to content

Pin golangci-lint version used

Oscar Tovar requested to merge otovar/fix-golangci-lint-job into master

What does this MR do?

This MR pins the version of golangci-lint used by the lefthook.yml file to version 1.50.1 (the same one used in the includes-dev/go.yml job image). I have been disabling the go-lint job for a while now because in the latest versions of golangci-lint, I've been getting depguard and revive errors caused by some dependency updates. To summarize the problem, the golangci-lint project has been updating their dependencies to version with breaking changes while simultaneously releasing non-breaking releases of their tool (something that I think breaks a lot of trust). This was the case for depguard and I believe was the same thing for revive.

To fix this, I opted to use docker to run the go-lint job instead of using golangci-lint directly. IMO this is the most straighforward way to ensure that we can run the tool on all operating systems (Linux + MacOS). To reproduce the bug, you can do the following:

  1. Checkout the Gemnasium project
  2. Create a new branch and introduce a change in a Go file. Commit the change so that your local copy is 1 commit ahead of the remote.
  3. Run the linter - lefthook run pre-push and verify that the linter errors (requires running lefthook install).
  4. Copy the changes from this config file to the local copy installed by lefthook. The local copy is installed in .git/info/lefthook-remotes/ci-templates/.golangci.yml.
  5. Re-run the linter - lefthook run pre-push and verify that it completes successfully.

Finally, I made every golangci-lint command verbose so that it was easier to verify if it was a config file issue or something else.

What are the relevant issue numbers?

N/A

Does this MR meet the acceptance criteria?

Merge request reports