Skip to content

vet: Support disable rule when enable-all is true #989

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

Merged
merged 1 commit into from
Mar 12, 2020

Conversation

ferhatelmas
Copy link
Contributor

Similar to the behavior of command line flags:
enable-all to enable existing linters then disable unwanted ones.
But for vet rules.

For example

govet:
  enable-all: true
  disable:
    - nilfunc

Similar to the behavior of command line flags:
enable-all to enable existing linters then disable unwanted ones.
But for vet rules.
@CLAassistant
Copy link

CLAassistant commented Mar 11, 2020

CLA assistant check
All committers have signed the CLA.

@ferhatelmas ferhatelmas changed the title Support disable rule when enable-all is true vet: Support disable rule when enable-all is true Mar 11, 2020
@ernado
Copy link
Member

ernado commented Mar 12, 2020

Thank you!
This looks OK, but are we sure that we want to use "enable-all" pattern that retrospectively is prone to unexpected failures after upgrade?
Currently we are discouraging usage of "enable-all" pattern and suggesting to explicitly enable linters.

Is there any difference with "vet"?

@ferhatelmas
Copy link
Contributor Author

ferhatelmas commented Mar 12, 2020

This looks OK

Good to hear.

are we sure that we want to use "enable-all" pattern that retrospectively is prone to unexpected failures after upgrade

Change in behavior is expected but failure shouldn't happen since it will disable more rules so will be running less.

However, clear mention in changelog should be enough I think.

Is there any difference with "vet"?

I think yes.

go vet ./... runs everything
go vet -nilfunc=false ./... disables nilfunc rule but runs every other rule.

This behavior wasn't supported with golangci-lint so far but with this PR, example config in the description enables it.

@ernado
Copy link
Member

ernado commented Mar 12, 2020

Oh, now I see the difference, thank you!

@ernado ernado merged commit 14eed91 into golangci:master Mar 12, 2020
@ldez ldez added this to the v1.24 milestone Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants