You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where you can see the incorrect transitive dependency. Trying to build with rules_go gives:
INFO: Invocation ID: c06c3ff9-38ba-4df2-88e4-29cadb34659d
ERROR: /home/thomas/.cache/bazel/_bazel_thomas/a41610ee02ad9c69b13020a7f1cf3deb/external/org_golang_x_tools_gopls/internal/lsp/source/BUILD.bazel:3:11: no such package '@org_golang_x_tools//go/analysis/passes/appends': BUILD file not found in directory 'go/analysis/passes/appends' of external repository @org_golang_x_tools. Add a BUILD file to a directory to mark it as a package. and referenced by '@org_golang_x_tools_gopls//internal/lsp/source:source'
I think a retraction of some version will be needed.
What did you see happen?
Successful build.
What did you expect to see?
Broken build
Workarounds
I have not been able to work around this issue so far. I intend to use a patch to fix it. I think the replace directive is intended to fix this kind of thing, but replace golang.org/x/tools v0.14.1 => golang.org/x/tools v0.14.0 does not work as it appears replace ignores patch versions.
The text was updated successfully, but these errors were encountered:
The short version is that gopls declares a dep on golang.org/x/tools v0.14.1
Actually, as per its go.mod file, it depends on golang.org/x/tools v0.14.1-0.20231114185516-c9d3e7de13fd, which is also reflected in the example go.mod you shared. Can you explain why you believe it to be an incorrect transitive dependency?
Oh, I see what you mean. I thought v0.14.1 and v0.14.1-0.20231114185516-c9d3e7de13fd were the same version, with the '-' part being some kind of digest.
Go version
go version go1.20.7 linux/amd64
Output of
go env
in your module/workspace:What did you do?
This is tricky to replicate but easy to prove. I am using rules_go, which integrates Go into the bazel ecosystem.
That becomes important here because it seems to be following
go.mod
more strictly than Go itself. The short version is that gopls declares a dep ongolang.org/x/tools v0.14.1
and ingopls/internal/lsp/source/options.go
imports golang.org/x/tools/go/analysis/passes/appends . However, golang.org/x/tools/go/analysis/passes/appends does not exist at v1.14.1. This breaks the build.I think that gopls compiling under Go successfully right now might come down to a bug.
If you create the following tools.go:
and run
go mod init; go mod tidy
, it will make something like this:Where you can see the incorrect transitive dependency. Trying to build with
rules_go
gives:I think a retraction of some version will be needed.
What did you see happen?
Successful build.
What did you expect to see?
Broken build
Workarounds
I have not been able to work around this issue so far. I intend to use a patch to fix it. I think the replace directive is intended to fix this kind of thing, but
replace golang.org/x/tools v0.14.1 => golang.org/x/tools v0.14.0
does not work as it appearsreplace
ignores patch versions.The text was updated successfully, but these errors were encountered: