Skip to content
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

govet: fix check-shadowing #4534

Merged
merged 1 commit into from
Mar 19, 2024
Merged

govet: fix check-shadowing #4534

merged 1 commit into from
Mar 19, 2024

Conversation

ldez
Copy link
Member

@ldez ldez commented Mar 19, 2024

If you are using this kind of configuration:

linters-settings:
  govet:
    check-shadowing: true
    enable-all: true
    disable:
      - fieldalignment

linters:
  disable-all: true
  enable:
    - govet

An error will appear:

$ ./golangci-lint run ./...                                                     
Error: govet: enable-all and enable can't be combined
Failed executing command with error: govet: enable-all and enable can't be combined

This a new problem related to the previous refactor: the validation doesn't happen at the same time as before (and it's a good thing).

Inside the govet implementation, the pass shadow is added to enable when check-shadowing is true, but as it's a pointer to the configuration, then the real configuration is also modified.

Note: check-shadowing is deprecated inside the code but not with a warning since 2019.
I will create another PR to deprecate this option.

@ldez ldez added bug Something isn't working linter: update Update the linter implementation inside golangci-lint labels Mar 19, 2024
@ldez ldez added this to the next milestone Mar 19, 2024
@ldez ldez changed the title fix: govet shadow govet: fix check-shadowing Mar 19, 2024
@ldez ldez merged commit 6914447 into golangci:master Mar 19, 2024
13 checks passed
@ldez ldez deleted the fix/govet-shadow branch March 19, 2024 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linter: update Update the linter implementation inside golangci-lint
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants