x/tools/gopls: vendored dependency lookup in workspace mode #53161
Labels
FrozenDueToAge
gopls
Issues related to the Go language server, gopls.
Tools
This label describes issues relating to any tools in the x/tools repository.
Milestone
gopls version
go env
What did you do?
I have a Go workspace where I'm developing two modules,
A
andB
. A version ofgithub.com/gorilla/mux
is imported and vendored byA
only, while a higher version is available in the module cache.B
has no reference tomux
.First, I asked gopls to find the definition of the imported
mux
package in one ofA
's source files. It sent me tomux
's source in the module cache, not the source invendor/
, while I expected it to find the latter, as that's what ends up inA
's binary.Next, I tried package lookup by running
go list -f '{{.ImportPath}} {{.Dir}}' github.com/gorilla/mux
inA
's module root. Same result.Now, with
go list
, I got the expected behaviour by doing either of the following:B
fromgo.work
. However,B
does not referencemux
, so why this helps is not clear to me.GOWORK=off go list <as above>
.Also, 1. above did not help in the gopls use-case.
What did you expect to see?
Package lookup results, at least when using gopls, point to sources in
vendor/
, not in the module cache.What did you see instead?
Package lookup results, using both
go list
and gopls, pointed to the module cache.Editor and settings
Emacs 28.1, lsp-mode 8.0.0.
The text was updated successfully, but these errors were encountered: