Skip to content
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

x/tools/gopls: does not download transitive dependencies of newly-required packages #44307

Closed
heschi opened this issue Feb 16, 2021 · 2 comments
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

Comments

@heschi
Copy link
Contributor

heschi commented Feb 16, 2021

Reported by @leitzler on #44247.

go get adds module requirements as // indirect. That's not what we want in gopls -- we're running go get because of an unsatisfied direct dependency. To avoid that, we resolve the desired package to its containing module, then run go mod edit -require $module to add the dependency, then go get $module to populate go.sum and download the module.

However, if the package the user wants to use has its own dependencies, simply downloading the newly-required module is insufficient. We should go get the exact package, not the module, so that the go command downloads its dependencies.

@heschi heschi changed the title x/tools/gopls: does not download packages when adding them as dependencies x/tools/gopls: does not download transitive dependencies of newly-required packages Feb 16, 2021
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Feb 16, 2021
@gopherbot gopherbot added this to the Unreleased milestone Feb 16, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.6.6 Feb 18, 2021
@gopherbot
Copy link

Change https://golang.org/cl/293729 mentions this issue: internal/lsp: 'go get' packages instead of modules

@gopherbot
Copy link

Change https://golang.org/cl/293835 mentions this issue: internal/lsp: 'go get' packages instead of modules

gopherbot pushed a commit to golang/tools that referenced this issue Feb 18, 2021
Previously, we were running `go get` only on modules, which led to us
not downloading dependencies of packages. This resulted in further
go.mod diagnostics that users could not resolve with quick fixes. Now,
download packages directly so that dependencies are downloaded.

Fixes golang/go#44307

Change-Id: Id764ea5a2f7028e238eadaaba0ca3cfc765b85b4
Reviewed-on: https://go-review.googlesource.com/c/tools/+/293729
Trust: Rebecca Stambler <rstambler@golang.org>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
(cherry picked from commit 9eb3535)
Reviewed-on: https://go-review.googlesource.com/c/tools/+/293835
@golang golang locked and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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.
Projects
None yet
Development

No branches or pull requests

3 participants