purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.67k stars 315 forks source link

Set up golangci-lint linter based on gometalinter #670

Open ginywiny opened 3 years ago

ginywiny commented 3 years ago

Creating a new PR because the previous one had a weird amount of strange commit history which went over my head to squash despite the many attempts taken.

Test HIGHLY based on test-gometalinter, as it is used to lint the same files, except where golangci-lint is used instead of gometalinter.

Notes:

  1. When golangci-lint uses the --skip-files flag, it still lints the file, but simply doesn't display the linting results.
  2. The build fails because the revive linter has found issues with certain files. This is new as revive is a new linter being used to replace golint, as it runs more quickly. This will be fixed down the line.
  3. Comments and TODOs from the previous gometalinter test file were kept in case new linters are being used.

What was done:

  1. Updated make deps script to install golangci-lint
  2. Created golangci-lint script based on test-gometalinter
  3. Updated test script to run test-golangci-lint
purpleidea commented 3 years ago

I see:

./test.sh: line 34: ./test/test-golangci-lint.sh: Permission denied

Did you u+x the file? Where do you see the list of lint errors we expect?

ginywiny commented 3 years ago

@purpleidea Whoops, must've forgot to change that. Fixed it and squashed. The list of errors are expected for the "revive" linter.

purpleidea commented 3 years ago

Great! Please rebase to master and force-push and let's see what happens. (I pushed some fixes.)

purpleidea commented 3 years ago

@ginywiny Want to rebase to newest master and fixup?

ginywiny commented 3 years ago

@purpleidea I will rebase and make a fix.