Pin viper module to v1.12.0 in go.mod
#5548
Closed
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.
I've been trying to get
golangci-lintto work withgo tool. The onlyissue I've run into so far is related to dependency versions.
I know that
golangci-lint's documentation warns against compilinggolangci-lintourselves, since the resulting binary is untested.However, in practice it's very close to working.
I'm importing the
golangci-lintmodule into a module that also importsviper. However, whilegolangci-lintimportsv1.12.0, my moduleimports
v1.19.0(the latest version). When I rungo tool golangci-lintthe Go compiler compiles
golangci-lintwith[email protected], whichbreaks part of the
revivelinter (see issue #3280). It possibly breaksparts of other linters, but my specific configuration did not reveal it.
I'm currently working around this by removing the configuration that
golangci-lintcan't handle when using[email protected]. However Ibelieve we can get the Go compiler to use
[email protected]forgolangci-lintand whatever other version for any module that wouldimport
golangci-lint. The trick is to add a replacement togolangci-lint'sgo.mod: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]andthe issue in the
revivelinter does not occur.This change requires disabling the
gomoddirectiveslinter in a coupleof
golangci-lint's tests. Those tests are completely unrelated to thatspecific linter or to
go.mod, so I figure it's fine.