-
Notifications
You must be signed in to change notification settings - Fork 37
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
[MM-49410] Added golangci-lint support #820
Conversation
PR fixes everything at this point except for shadowing. Enabling shadowing outputs a lot more errors around (most of them |
Do we need to skip |
yeah, since mocks code is autogenerated, there's no point in linting it, since we're not going to fix the lint errors each time we run |
From my experience, shadowing is one of those issues which are a pain to fix, but sometimes a bug eventually falls through. So it's not very urgent, but I'd suggest to fix them. What we usually do in server is to rename This was a real bug that we fixed caused due to shadowing: https://github.com/mattermost/enterprise/pull/594/files. It might look simple now but sometimes it's easy to miss. |
I am okay with us setting the shadow check to disabled initially so we can get this running in CI/CD. We can then do some follow-up changes to correct shadowing issues and enable enforcement with shadow-checking. |
I'm already taking care of all the shadowing issues, I wanted to have it done by today but other things came up. I will have it ready by monday. |
# Conflicts: # internal/tools/terraform/plan.go
I agree with turning on the shadow check. But I'm not a fan of using Like _, err2 := exec.LookPath(extraTool)
if err2 != nil {
return errors.Errorf("failed to find %s on the PATH", extraTool)
} Instead of using
Though both are the same. |
I agree with that, and I think I tried to use a similar naming outside of tests (so logic makes sense) but I may have missed some since most changes were mechanical after the first dozen or so. If you have spotted some tell me and I'll change it. |
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.
LGTM! There are a few err2
type names outside of tests that I don't love, but this is totally fine. We can just change them later if they bug us.
@@ -953,44 +953,6 @@ func (s *InstallationSupervisor) waitForUpdateStable(installation *model.Install | |||
return model.InstallationStateStable | |||
} | |||
|
|||
// Unused stub function |
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.
C'mon linter! It says right there it's unused. Why do you just leave it alone!? 😂
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.
LGTM. But I would love to see the changes in err2
, err3
naming in future.
Summary
Added golangci-lint support
Ticket Link
https://mattermost.atlassian.net/browse/MM-49410
Release Note