Cleanup: uplevel our technical hygiene by enabling additional Golang linters
Feature request
golangci-lint which we have configured supports additional helpful linters that we are not using.
This FR suggests that we uplevel our technical hygiene by enabling more linters and cleaning up
the issues they identify.
Note: I'd like to see the same linter suite applied across all tektoncd repos.
Documentation: https://golangci-lint.run/usage/linters See also: http://goo.gle/go-style
Linters that I would like to see enabled:
- [x] bodyclose - https://github.com/tektoncd/pipeline/pull/5924
- [ ] conttainedctx
- [x] decorder - https://github.com/tektoncd/pipeline/pull/5924
- [x] depguard
- [ ] dogsled
- [ ] dupl
- [x] dupword - https://github.com/tektoncd/pipeline/pull/5918
- [x] https://github.com/tektoncd/pipeline/pull/5923
- [x] errcheck
- [ ] errchkjson
- [ ] errname
- [ ] errorlint
- [ ] exhaustive
- [ ] funlen
- [ ] gocognit
- [ ] goconst
- [x] gocritic
- [x] gofmt
- [x] goimports
- [x] gomodguard
- [x] gosec
- [x] gosimple -- https://github.com/tektoncd/pipeline/pull/5904
- [x] govet
- [ ] ineffassign
- [ ] ireturn
- [x] misspell
- [x] ~nosnakecase~ (deprecated)
- [x] revive
- [ ] staticcheck
- [x] thelper -- https://github.com/tektoncd/pipeline/pull/5927
- [ ] tparallel
- [x] typecheck -- https://github.com/tektoncd/pipeline/pull/5924
- [x] unconvert
- [ ] unparam
- [x] unused -- https://github.com/tektoncd/pipeline/pull/5881
- [x] usestdlibvars -- https://github.com/tektoncd/pipeline/pull/5918
- [ ] varnamelen
- [x] whitespace -- https://github.com/tektoncd/pipeline/pull/5889
- [ ] wrapcheck
I would assign this issue to me, but I don't seem to have the authority to do so. 🙃
#5871 Added govet to our Golang linter suite
#5881 Replaced deprecated deadcode linter with unused linter
#5889 Enabled the whitespace linter.
/assign @bendory
(btw, if you comment /assign, it should automatically assign the issue to you 😉 )
(ah lol, @jerop manually assigned you already 😂 )
See also: https://github.com/tektoncd/community/pull/908 Add Go style guide to community standards (thanks @lbernick)
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.
/lifecycle stale
Send feedback to tektoncd/plumbing.
Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.
/lifecycle rotten
Send feedback to tektoncd/plumbing.
Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.
/close
Send feedback to tektoncd/plumbing.
@tekton-robot: Closing this issue.
In response to this:
Rotten issues close after 30d of inactivity. Reopen the issue with
/reopenwith a justification. Mark the issue as fresh with/remove-lifecycle rottenwith a justification. If this issue should be exempted, mark the issue as frozen with/lifecycle frozenwith a justification./close
Send feedback to tektoncd/plumbing.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.