-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Raw map configuration and case sensitivity #3280
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
Comments
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors. |
Hello,
As you have checked this, can you give me the output of the revive command line? |
Sure,
With the following config: [rule.context-as-argument]
arguments = [{allowTypesBefore = "*testing.T"}] as taken from here: https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md#context-as-argument |
It's related to github.com/spf13/[email protected] (#3205) So it's a breaking change inside Viper introduced by a bug fix, the new behavior will not change because it's the expected behavior from the Viper point of view, but it's a major problem for us. EDIT: I reverted the update of Viper #3284 (golangci-lint v1.50.1) Related: |
This is currently incompatible with viper v1.13.0. Status for the linter found at golangci/golangci-lint#3280
This is currently incompatible with viper v1.13.0. Status for the linter found at golangci/golangci-lint#3280
This is currently incompatible with viper v1.13.0. Status for the linter found at golangci/golangci-lint#3280
This is currently incompatible with viper v1.13.0. Status for the linter found at golangci/golangci-lint#3280
This is currently incompatible with viper v1.13.0. Status for the linter found at golangci/golangci-lint#3280 Co-authored-by: Tyler Yahn <[email protected]>
I've been trying to get `golangci-lint` to work with `go tool`. The only issue I've run into so far is related to dependency versions. I'm importing the `golangci-lint` module into a module that also imports `viper`. However, while `golangci-lint` imports `v1.12.0`, my module imports `v1.19.0` (the latest version). When I run `go tool golangci-lint` the Go compiler compiles `golangci-lint` with `[email protected]`, which breaks part of the `revive` linter (see issue golangci#3280). It possibly breaks parts of other linters, but my specific configuration did not reveal it. I'm currently working around this by removing the configuration that `golangci-lint` can't handle when using `[email protected]`. However I believe we can get the Go compiler to use `[email protected]` for `golangci-lint` and whatever other version for any module that would import `golangci-lint`. The trick is to add a replacement to `golangci-lint`'s `go.mod`: ```gomod replace github.com/spf13/viper => github.com/spf13/viper v1.12.0 ``` I've experimented with this fix by using Go workspaces and it seems to work as desired. The parent module can still use `[email protected]` and the issue in the `revive` linter does not occur. This change requires disabling the `gomoddirectives` linter in a couple of `golangci-lint`'s tests. Those tests are completely unrelated to that specific linter or to `go.mod`, so I figure it's fine.
Welcome
Description of the problem
It seems that golangci-lint (starting with v1.50?) passes the arguments to linters in lower case and not "as is".
This causes in our cases
panic
inrevive
which can be tracked down to: https://github.com/mgechev/revive/blob/v1.2.4/rule/context-as-argument.go#L82-L110.
The same config with the same code base works fine with v1.49
Version of golangci-lint
Configuration file
Go environment
Verbose output of running
Code example or link to a public repository
// add your code here
The text was updated successfully, but these errors were encountered: