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: can't upgrade transitive dependencies #45262

Closed
inliquid opened this issue Mar 27, 2021 · 6 comments
Closed

x/tools/gopls: can't upgrade transitive dependencies #45262

inliquid opened this issue Mar 27, 2021 · 6 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. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@inliquid
Copy link

  1. VS Code
  2. gopls@master

Getting this error when calling "Upgrade transitive dependencies". "Upgrade direct dependencies" works.

And when I call go get -u -d ./..., it also upgrades everything including transitive normally.

[Error - 16:51:49] 2021/03/27 16:51:49 command error: err: exit status 1: stderr: go: downloading golang.org/x/sys v0.0.0-20210326220804-49726bf1d181
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/detectknown
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/fieldnum
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/fieldsort
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/genname
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/mapsort
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/testprotos/fieldmaskpb


[Error - 16:51:49] Request workspace/executeCommand failed.
  Message: err: exit status 1: stderr: go: downloading golang.org/x/sys v0.0.0-20210326220804-49726bf1d181
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/detectknown
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/fieldnum
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/fieldsort
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/genname
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/mapsort
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/testprotos/fieldmaskpb

  Code: 0 

@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 Mar 27, 2021
@gopherbot gopherbot added this to the Unreleased milestone Mar 27, 2021
@stamblerre stamblerre modified the milestones: Unreleased, gopls/v0.6.10 Mar 30, 2021
@stamblerre
Copy link
Contributor

Thanks for the report! Currently, the upgrade transitive dependencies command runs go get -u all in your working directory. Does that fail with the same error message?

/cc @heschi for additional help on go commands/upgrading modules

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Mar 30, 2021
@stamblerre stamblerre changed the title x/tools/gopls: Can't upgrade transitive dependencies x/tools/gopls: can't upgrade transitive dependencies Mar 30, 2021
@inliquid
Copy link
Author

Yes, go get -u all fails

> go get -u all 
go: downloading golang.org/x/net v0.0.0-20210330075724-22f4162a9025
go: downloading github.com/golang/protobuf v1.5.2
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/detectknown
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/fieldnum
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/fieldsort
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/genname
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/mapsort
go get all: module google.golang.org/protobuf@upgrade found (v1.26.0), but does not contain package google.golang.org/protobuf/internal/testprotos/fieldmaskpb

What's the difference between go get -u all and go get -u -d ./... in general? I was using latter all the time time since modules introduction on different projects with no issues. And it's actually mentioned in documentation, so I suppose it's officially recommended? https://golang.org/ref/mod#go-get

Also I'd like to see which go commands gopls is running, for example in gopls output (right now it's empty). Is it possible?

@stamblerre
Copy link
Contributor

What Go version are you using? @bcmills mentioned that in 1.16, go get -u -t ./... should behave the same as go get -u all. For earlier versions, it seems like go get -u -t ./... is the correct command, so we'll switch to that.

Also I'd like to see which go commands gopls is running, for example in gopls output (right now it's empty). Is it possible?

No, this is not possible. You will see the name of the command in the logs, but we don't currently log the full go command. Usually it has some additional flags and would be too verbose for most cases.

@inliquid
Copy link
Author

inliquid commented Apr 6, 2021

I'm using go1.16 right now it's 1.16.3. Note that I'm using go get -u -d ./..., not go get -u -t ./... which effectively updates transitive dependencies, not only direct ones.

@bcmills
Copy link
Contributor

bcmills commented Apr 6, 2021

@inliquid, the -u flag is what causes transitive dependencies to be updated. The -t flag causes go get to trace the test dependencies of the named packages.

I think I also forgot the -d flag in my suggestion to @stamblerre.

So go get -d -u -t ./... means:

  • go get -d: “fetch and download (but do not build)”
  • -u: “upgraded transitive dependencies”
  • -t: “including dependencies of tests”
  • ./...: “for all packages in subdirectories within the module”.

@stamblerre stamblerre self-assigned this Apr 6, 2021
@gopherbot
Copy link

Change https://golang.org/cl/307889 mentions this issue: internal/lsp: switch to 'go get -u ./...' for transitive upgrades

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. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants