-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Set up workflow for golangci #2020
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
What prompted you to write this PR? |
Hi! I saw it defined in https://github.com/google/go-querystring, I thought the project might be interested |
@willnorris - I defer to your judgment on this one and #2019. |
@@ -0,0 +1,13 @@ | |||
linters: | |||
enable: | |||
- dogsled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggest to add ercheck and govet to the list
https://golangci-lint.run/usage/linters/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those two are active by default, see https://golangci-lint.run/usage/linters/#enabled-by-default-linters. I haven't deactivated them. It would require disable-all
to be true under the linters item in this case
https://golangci-lint.run/usage/configuration/#config-file
Co-authored-by: Will Norris <will@willnorris.com>
Codecov Report
@@ Coverage Diff @@
## master #2020 +/- ##
=======================================
Coverage 97.86% 97.87%
=======================================
Files 107 107
Lines 6901 6907 +6
=======================================
+ Hits 6754 6760 +6
Misses 81 81
Partials 66 66
Continue to review full report at Codecov.
|
so that's a lot of errors. I see that you have golangci-lint returning a 0 status, so this doesn't break builds. What's the plan then... a handful of follow-up PRs that address these individual errors, and then we eventually remove the We might also end up wanting to disable some of these, or at least for certain paths. For example, the dogsled errors in test files are probably not worth fixing. Same for the duplicate code detection. Our tests do duplicate some code and that's fine. Trying to refactor to remove the duplication is likely to make the tests less readable (at least in some cases). |
The --issues-exit-code=0 is to display the actual triggered warnings/errors without making the job failing indeed. |
What about something like: linters:
# TODO: fix errors so that all of the linters below pass.
# The linters that are commented out, as well as those explicitly disabled,
# are currently failing. We should fix those failures or define exclusion
# rules, and then enable those linters.
enable:
- dogsled
- dupl
- gofmt
- goimports
# - gosec
- misspell
- nakedret
# - stylecheck
# - unconvert
# - unparam
# - whitespace
disable:
- errcheck
- gosimple
- staticcheck
- ineffassign
- unused
issues:
exclude-rules:
- linters:
- dogsled
text: "declaration has 3 blank identifiers"
path: _test\.go
- linters:
- dupl
path: _test\.go then, as folks want to fix these, they can enable a specific linter locally, run golangci-lint to see what's failing, and fix those errors. That doesn't give us visibility in the CI logs of what is failing, but I think that's okay for now, especially since these won't take very long to fix. |
This PR doesn't fix the identified problem raised by the analysis