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
Closed

Comments

@heschi
Copy link
Contributor

@heschi 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 this to the Unreleased milestone Feb 16, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.6.6 Feb 18, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Feb 18, 2021

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

@gopherbot
Copy link

@gopherbot gopherbot commented Feb 18, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants