I have added the goimports linter thru pre-commits.
To make it works on your machine you will need to have pre-commit & golangci-lint installed (used brew on my Fedora) and do a pre-commit install on the root of the repo.
If you want to perform manually the linting of all the files you can do a pre-commit run --all-files (I did it for the second commit of this branch).
Otherwise everytime a commit is made the linting is also made on all the files.
I've only enabled goimports but if you want you can play with more (golangci-lint linters to have the complete list).
For example adding gosimple in the .golangci.yaml config will check for code simplification like reducing:
I have added the
goimports
linter thru pre-commits.To make it works on your machine you will need to have
pre-commit
&golangci-lint
installed (usedbrew
on myFedora
) and do apre-commit install
on the root of the repo.If you want to perform manually the linting of all the files you can do a
pre-commit run --all-files
(I did it for the second commit of this branch).Otherwise everytime a commit is made the linting is also made on all the files.
I've only enabled
goimports
but if you want you can play with more (golangci-lint linters
to have the complete list).For example adding
gosimple
in the.golangci.yaml
config will check for code simplification like reducing:into: