-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Makefile: drop gofmt in favor of golangci-lint #7260
Conversation
Codecov Report
@@ Coverage Diff @@
## master #7260 +/- ##
=======================================
Coverage 55.83% 55.83%
=======================================
Files 586 586
Lines 35851 35851
=======================================
Hits 20017 20017
Misses 13871 13871
Partials 1963 1963 |
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.
@robert-zaremba dixit:
It's better to explicitly disable default lint checkers rather then disable all of them. The main reason is that if we golangci-lint will have a very good and useful checker we may skip him.
I used to think likewise, and I changed my mind since then. The problem is that if we enable all checks by default, new checks may be introduced unpromptedly, causing PRs to fail unexpectedly - been there, done that and developers felt annoyed.
.golangci.yml
Outdated
- errcheck | ||
- wsl | ||
- varcheck |
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.
errcheck
is the only needed here if you are not using disable-all
. They practically do the same thing because the only linter from the defaults we keep disabled is errcheck
. This is more of a preference thing.
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.
One of the motivation of this PR is to not use disable-all
. From my OP:
It's better to explicitly disable default lint checkers rather then disable all of them. The main reason is that if we golangci-lint will have a very good and useful checker we may skip him.
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.
Can we enable varcheck, also WSL is not needed here, it's not a default linter
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.
BTW: we also disabled varcheck
- it's slow and unused
is faster and check functions as well.
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.
I removed the line with wsl
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 better to explicitly disable default lint checkers rather then disable all of them.
I'd argue that no, that is not necessarily better, reason being:
if we enable all checks by default, new checks may be introduced unpromptedly, causing PRs to fail unexpectedly
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.
I'm fine with rolling back to disable-all
, just need clear confirmation for that.
@alessio - I think it's easier to disable a linter if needed (adding one line of code) than update for an some important one (because in the latter situation we will not see it). |
Please see #5733, the |
Thanks for the link. I don't know if Goland's Golint plugin still have that issue. Any Goland user here? |
On Tue, Sep 8, 2020 at 3:22 PM Robert Zaremba ***@***.***> wrote:
Please see #5733 <#5733>, the
disable/enable thing was reconciled that was to mitigate Goland's Golint
plugin users' headache
Thanks for the link. I don't know if Goland's Golint plugin still have
that issue. Any Goland user here?
The majority AiB's engineers are Goland users :)
|
So, should I use |
I don't think that that is the right way to go about it. Let's try build consensus around a decision first, shall we? I've tried Goland's Golinter, and it seems to work just fine. @robert-zaremba I've just got a question: if we use both |
If the |
Thanks for clarifying! Two questions:
If a plugin enabled by default will be enabled regardless of whether it is included in the
We may disagree with decisions made by My 2p |
Because only few linters are enabled by default. To enable other plugins we need to use |
Correct. That's why |
Indeed yet I think we should continue discussing as one question is yet to be answered:
Now, let's pretend that we have plugins A, B, C in the
Mind elaborating on this please @robert-zaremba? |
(Another point I'm trying to make is that we should always aim to get to a deterministic state of things, i.e. that is easily done by using either
|
@alessio sure, let me elaborate.
Yes.
The point of using
|
Linters tend to ring alarm bells for stylistic mistakes. If we enable everything that is disabled by default by
This is exactly the reason why we've come up with a custom
Yeah, and raise another PR, or add the file to your local In all honesty, this makes very little sense to me. I'd propose to leave the default configuration as it is so that we don't lose control over our builds, create another |
Any decision here? Shall I move back to |
How about |
I don't think this is helpful. We need to be everyone on the same page. We don't want that someone will see more errors and will fix them for others. So, shall I use |
5ebfef2
to
87aca8a
Compare
It seams that we stuck here. I've rolled back to use |
Looks good to me. Just a small note: lint-fix should be incorporated in the |
Thanks. Re |
We've tried that in the past, and no warnings were actually fixed. It seems odd to me to add a |
If a tool can sort out some issues for me that it's a DevX improvement. So I checked for you which linters have an option to automatically fix issues:
|
Adding more commands on top of other commands is not a DevX improvement. Very much like adding flags to commands is reckoned to worsen DevX (incidentally this is also how Golang goes about commands development). Please integrate this in the |
Some historical concerns wrt using |
@alessio from what I understood, you want to integrate the |
@blushi |
Description
It's better to explicitly disable default lint checkers rather then disable all of them. The main reason is that if we
golangci-lint
will have a very good and useful checker we may skip him.Other changes:
gofmt
command frommake lint
. It's not needed becausegolangci-lint
is handling it (and it's doing it faster because gofmt doesn't need to re-read files)..vendor
patterns - we don't use patterns any moreBefore we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorer