-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
gocritic: update default checks list && fix new added gocritic linting errs #342
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
gocritic: update default checks list && fix new added gocritic linting errs #342
Conversation
Update gocritic default checks list, add the current gocritic stable checks list
CC/ @jirfag not sure why the the check is failing. It looks that |
thank you for the pull request! I guess you've used installed binary of golangci-lint in generation of README.md, therefore |
Thanks @jirfag! It looks like we've have now "gocritic" checks that are not passing. If you want to go forward with this I could update this with a new commit including the needed changes. |
Fix code to pass newly added gocritic checks, mainly pointer receivers and import shadows
@@ -237,18 +237,18 @@ func (m Manager) GetAllEnabledByDefaultLinters() []linter.Config { | |||
return ret | |||
} | |||
|
|||
func linterConfigsToMap(lcs []linter.Config) map[string]*linter.Config { | |||
func linterConfigsToMap(lcs []*linter.Config) map[string]*linter.Config { | |||
ret := map[string]*linter.Config{} | |||
for _, lc := range lcs { | |||
lc := lc // local copy |
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.
@jirfag Is this local copy necessary now if we use pointers?
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.
it's for scopelint
I guess - it finds a lot of false-positives
PTAL @jirfag |
I was looking too long because I had doubts do we really need to enable performance checks in go-critic by default. Some developers can say that fixing them is a premature optimization. And a lot of users just use |
@jirfag I understand, but IMHO the only way to stay safe is to disable all linters by default. Then define all your linters + checks manually. I agree that this would change "enable-all" users current behaviour, but also it will the inclusion of a new default enabled check (gocritic was enabled) and even more drastically. Maybe this information should be added somewhere in the docs to warn new users. |
Btw I have some ideas to face versioning and breaking changes. I could give more details or propose something when I have more time :) |
I've already warned in README about it, it doesn't help :) |
Closes #341