-
-
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
depguard: fix GOROOT detection #3866
Conversation
Once v1.29 golangci/golangci-lint#3866 lands, we can revert this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Would an alternative be to roll back depguard
instead to not have to keep a fork around forever? It doesn't really matter having it around so I'll approve, just curious.
Latest version came with problems with depguard: OpenPeeDeeP/depguard#46 Current solution for now is pinning golangci-lint version to do not use latest deps. Fix is currently ongoing here: golangci/golangci-lint#3866 But anyway it's good idea to have a pinned version and do not consume from latest.
Latest version came with problems with depguard: OpenPeeDeeP/depguard#46 Current solution for now is pinning golangci-lint version to do not use latest deps. Fix is currently ongoing here: golangci/golangci-lint#3866 But anyway it's good idea to have a pinned version and do not consume from latest.
I didn't roll back because the depguard v2 configuration is breaking and I think that we don't have to wait for more to break this, and because this new version of depguard fixes an annoying old bug with concurrency. |
@ldez looks like you have to convince the CI that this is okay... https://github.com/golangci/golangci-lint/actions/runs/5153483603/jobs/9280765338 |
It's just because we use the previous version inside the CI. |
@ldez Do you know how long it takes to get the fix populated in GHA? We are using the |
the GitHub action is currently generating the GHA files https://github.com/golangci/golangci-lint/actions/runs/5153980997/jobs/9281874877 It will be available quickly. |
Following the plan that I explained here:
replace
directives, becausereplace
directives are not transitive, so users that are using that use thetools
pattern will not have a problem.)Summary of issue #3862:
depguard uses
build.Default.GOROOT
but this value is filled correctly only if theGOROOT
is defined through an env var.The "expander" cannot be overridden because it's a global variable inside an internal package, the
compile
method that produces the error and the analyzer constructor are not exported.The fix I have done in our
depguard
fork is based on what is done insidegolang.org/x/tools
.golangci/depguard@v2.0.1...ed68d37
When the PR OpenPeeDeeP/depguard#48 will be merged and when depguard will create a new release, we will drop this dependency (but we will have to keep the fork for compatibility.)
Fixes #3862