[MB-13908] Update golangci-lint config #9201
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Jira ticket for this change
Summary
This PR updates and cleans up our
golangci-lint
config. Some of this work was deferred from #9064 when we added thegci
linter. Specifically, the following changes are being made:deadcode
,structcheck
, andvarcheck
. Per the documentation, these linters were abandoned by the author and theunused
linter should be used as the replacement for all three.enable
section was not the complete list that were being run. There are several others that were enabled by default, including theunused
one noted above. So, I've addedgosimple
andunused
in explicitly here to avoid any confusion about what linters are actually running. If you want to see a list of all enabled linters, get a local version ofgolangci-lint
and rungolangci-lint linters
.deadline
setting underrun
has been deprecated andtimeout
should be used in its place.mocks
directories, I skip any directory that ends inmocks
since we do have a mocks directory calledghcmocks
that we had to create to get around some circular dependency issues.go
version to1.17
that we introduced when moving to go 1.18 has been removed because the problem linters have either been fixed or deprecated.1.17
workaround, I realized that an annotation and linter suppression added/approved in a previous PR was inadvertently removed in a subsequent PR's refactor. This PR adds it back.CODEOWNERS
file was referencing the wrong filename for the golangci-lint config, so I've fixed that.Setup to Run Your Code
How to test:
make clean server_build client_build build_tools
pre-commit run -a
to make sure there are no linter issuespre-commit run -a --verbose golangci-lint
to see if there are any warnings about linters being turned off (there shouldn't be anymore)golangci-lint linters
to see a list of enabled/disabled linters for our configurationVerification Steps for Author
These are to be checked by the author.