CI: enable disabled linters and remove exclusions from .golangci.yml
This is a follow up of the golangci-lint migration to v2 that was done with:
- #1645
- #1708
The migration revealed that:
- examples folder was not linted
- some packages have no godoc comment
- many function has no godoc comment to explain what they do
- embedded structs are calling the methods of embedded field, instead of the methods struct
- some if/else chains could be updated to use switch
- some presets are enabled
All of these are excluded in the .golangci.yml file and taggued with a TODO comment.
This issue is about removing exclusions one by one.
Please note that many of the things that need to be fixed can be done by removing the exclusions and use golangci-lint run -fix
Also, please note that you must run golangci-lint in each folder that contains a go.mod file. Otherwise you will only lint the main module and not the submodules.
hey @ccoVeille I would like work on this task but will like to abstract the complete task into tiny ones and solve it! Need your comments :)
Sure, that the best way to do it.
You could start by adding godoc comments to methods, variabled and comments
So here it would be about removing these two, then run golangci-lint locally and fix what is reported
staticcheck:
checks:
- -ST1000 # TODO remove this line and fix reported errors
exclusions:
rules:
- linters:
- revive
text: "exported (.+) should have comment" # TODO fix errors reported by this and remove this line
I am a Gofr-SOC participant. Please assign this to me.