-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
- #5547
Closed
Closed
- #5547
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… 4 updates (golangci#5532) Co-authored-by: Fernandez Ludovic <[email protected]>
…langci#5483) Co-authored-by: Simon Sawert <[email protected]> Co-authored-by: Fernandez Ludovic <[email protected]>
golangci#5542) Co-authored-by: Fernandez Ludovic <[email protected]> Co-authored-by: Anton Telyshev <[email protected]>
Co-authored-by: Fernandez Ludovic <[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.
Hey, thank you for opening your first Pull Request ! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.