Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix: improve Go version detection inside workspace #5179

Merged
merged 2 commits into from
Dec 1, 2024

Conversation

ldez
Copy link
Member

@ldez ldez commented Nov 30, 2024

Fixes #4894

To reproduce
#!/bin/bash -e

rm -rf wpsample

mkdir wpsample
cd wpsample

go work init

mkdir a b
echo module a > a/go.mod
echo go 1.20 >> a/go.mod

echo module b > b/go.mod
echo go 1.22 >> b/go.mod

echo package main > b/main.go

go work use a
go work use b

cd b

golangci-lint run --enable=copyloopvar,intrange
Note

By adding golang.org/x/mod as a dependency, a bug inside the integration test for gomodguard has been detected.
The test used the go.mod of golangci-lint instead of a dedicated go.mod so we never saw the problem.
The module defined inside the allowed section was not a module but a package (golang.org/x/mod/modfile) and as the go.mod of golangci-lint didn't contain golang.org/x/mod the problem was hidden.
So I fixed the test because without that, the CI was unhappy with this PR.

@ldez ldez added the bug Something isn't working label Nov 30, 2024
@ldez ldez added this to the next milestone Nov 30, 2024
@ldez ldez force-pushed the fix/go-version-wp branch from 1b30c52 to aaebd52 Compare November 30, 2024 23:24
@ldez ldez merged commit 6b5f742 into golangci:master Dec 1, 2024
15 checks passed
@ldez ldez deleted the fix/go-version-wp branch December 1, 2024 13:42
@ldez ldez modified the milestones: next, v1.63 Jan 1, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area: workspace bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

golangci-lint incorrectly complains about Go version being lower than needed (Go workspace)
2 participants