Skip to content

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 requested review from alexandear and bombsimon March 19, 2024 02:14
@ldez ldez merged commit 6914447 into golangci:master Mar 19, 2024
@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.

2 participants