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: re-enable upgrade lenses for individual dependencies #42969

Closed
wtask opened this issue Dec 3, 2020 · 16 comments
Closed

x/tools/gopls: re-enable upgrade lenses for individual dependencies #42969

wtask opened this issue Dec 3, 2020 · 16 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

@wtask
Copy link

wtask commented Dec 3, 2020

What version of Go, VS Code & VS Code Go extension are you using?

  • Run go version to get version of Go
    • go version go1.15.5 windows/amd64
  • Run gopls -v version to get version of Gopls if you are using the language server.
    • v0.5.4
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders
    • 1.51.1
      e5a624b788d92b8d34d1392e4c4d9789406efe8f
      x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • 0.19.0
  • Run go env to get the go development environment details
    set GO111MODULE=on
    set GOARCH=amd64
    set GOBIN=c:\dev\go\bin
    set GOCACHE=C:\Users\webta\AppData\Local\go-build
    set GOENV=C:\Users\webta\AppData\Roaming\go\env
    set GOEXE=.exe
    set GOFLAGS=
    set GOHOSTARCH=amd64
    set GOHOSTOS=windows
    set GOINSECURE=
    set GOMODCACHE=C:\dev\go\pkg\mod
    set GONOPROXY=gitlab.XXX
    set GONOSUMDB=gitlab.XXX
    set GOOS=windows
    set GOPATH=C:\dev\go
    set GOPRIVATE=gitlab.XXX
    set GOPROXY=https://proxy.golang.org,direct
    set GOROOT=c:\go
    set GOSUMDB=sum.golang.org
    set GOTMPDIR=
    set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
    set GCCGO=gccgo
    set AR=ar
    set CC=gcc
    set CXX=g++
    set CGO_ENABLED=1
    set GOMOD=NUL
    set CGO_CFLAGS=-g -O2
    set CGO_CPPFLAGS=
    set CGO_CXXFLAGS=-g -O2
    set CGO_FFLAGS=-g -O2
    set CGO_LDFLAGS=-g -O2
    set PKG_CONFIG=pkg-config
    set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\webta\AppData\Local\Temp\go-build547893570=/tmp/go-build -gno-record-gcc-switches

Describe the bug

So bug description is in the title for this issue.

Steps to reproduce the behavior:

  1. Open your go.mod in the editor.
  2. Wait a little time to appear update suggestions above dependencies references... Wait... Nothing happen.
  3. Downgrade gopls go get golang.org/x/tools/gopls@v0.5.3 and restart vscode
  4. Repeat 1-2 and see the suggestions is appeared.
@hyangah
Copy link
Contributor

hyangah commented Dec 3, 2020

Thanks for the report. @wtask Indeed, I could reproduce this with v0.5.4 and the version built at head (git clone & go install from gopls directory). I don't see any explicit mention of this change yet from the release note so not sure if it's an intended change or not. Transferring to the gopls issue tracker to triage.

@hyangah hyangah changed the title vscode-go stopped suggest dependencies updates for go.mod after upgrading gopls to v0.5.4 x/tools/gopls: gopls stopped showing dependencies updates for go.mod after upgrading to v0.5.4 Dec 3, 2020
@hyangah hyangah transferred this issue from golang/vscode-go Dec 3, 2020
@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 Dec 3, 2020
@gopherbot gopherbot added this to the Unreleased milestone Dec 3, 2020
@heschi
Copy link
Contributor

heschi commented Dec 3, 2020

This was indeed a deliberate change (https://golang.org/cl/271297) that we missed in the release notes.

@stamblerre
Copy link
Contributor

stamblerre commented Dec 3, 2020

Thanks for this catch, just updated the release notes to include this. #38339 tracks the way in which we will rework this behavior--we will likely expose a code action that offers an upgrade when you click on the require line. (Release notes)

@stamblerre
Copy link
Contributor

Duplicate of #38339

@stamblerre stamblerre marked this as a duplicate of #38339 Dec 3, 2020
@wtask
Copy link
Author

wtask commented Dec 3, 2020

@stamblerre Does it mean that gopls v0.5.4 drops any support for per-dependency updates notification? And only Upgrade All option will be available? Painful, unhappy coding. I never saw "Upgrade all dependencies" for my go.mod, what is this?

@wtask
Copy link
Author

wtask commented Dec 3, 2020

As for me, per-dependency update notification is very useful feature of vscode-go, and now it is absent. So I have to stay on gopls v0.5.3

@majst01
Copy link

majst01 commented Dec 10, 2020

I also miss this feature heavily, the "upgrade all dependencies" at the top of the file is not very helpful, because this wont work for most of the projects which depend on k8s.io/*.

So would be very nice if at least the old behavior could be enabled on will again.

@wtask
Copy link
Author

wtask commented Dec 10, 2020

@majst01 I found only this helper https://github.com/psampaz/go-mod-outdated to replace missed feature, but it's inconvenient.

@stamblerre
Copy link
Contributor

stamblerre commented Dec 10, 2020

I also miss this feature heavily, the "upgrade all dependencies" at the top of the file is not very helpful, because this wont work for most of the projects which depend on k8s.io/*.

@majst01: Do you mind explaining why that is?

#38339 tracks our work in replacing this feature--we will be adding an "Update direct dependencies" code lens in the next release.

@majst01
Copy link

majst01 commented Dec 11, 2020

@stamblerre of course. If you have a project which relies on some kubernetes dependencies, updating all dependencies for various reasons. The most obvious is that k8s.io/client-go must follow the other k8s.io dependencies like k8s.io/apimachinery, but the most recent version of client-go is v11.x which is based on an older versioning scheme back then. In reality the actual version is v0.19.4. With this situation alone it is not possible anymore to update any dependencies from vscode, because client-go v11.x is not compatible with k8s.io/apimachinery v0.19.x. The update all dependencies action will not succeed, and you have to update every dependency by hand.

I am sure lot of developers have the same problem i describe here.

One example from of our projects is the cloud controller manager for metal-stack.io
https://github.com/metal-stack/metal-ccm
This is a small project, but has lots of k8s.io dependencies because this is the way cloud-controller interface has to be implemented.
If you have spare time, check out master and try.

@stamblerre stamblerre reopened this Dec 11, 2020
@stamblerre stamblerre changed the title x/tools/gopls: gopls stopped showing dependencies updates for go.mod after upgrading to v0.5.4 x/tools/gopls: upgrade direct dependencies does not work Dec 11, 2020
@majst01
Copy link

majst01 commented Dec 11, 2020

@stamblerre thanks !

@sebrandon1
Copy link

Here I thought this was a bug with the latest version of Gopls. Myself and a number of my colleagues really liked the ability to click and update the various go.mod entries. Add my name to the list of people who want this feature re-enabled.

@wtask
Copy link
Author

wtask commented Dec 16, 2020

gopls v0.6.0 with "Upgrade direct dependencies" doesn't work. Got git errors. But running the first problematic command from error popup directly in console works as expected go get {dependency}. Unusable feature.
I lightly misunderstanding what is the sense to present blind, unattended batch upgrade for all dependencies? Do you develop vscode-go in the same way? Upgrading all and then will check what is happened?

@stamblerre
Copy link
Contributor

gopls v0.6.0 with "Upgrade direct dependencies" doesn't work. Got git errors.

I would be happy to help investigate what went wrong here if you would like to share the errors.

Please note, you can always update your dependencies on the command line by running go get {dependency}--that's all the individual upgrade code lenses were doing. While this editor feature was convenient, its absence should not prevent you from upgrading individual dependencies.

As I have noted previously, the granular updates posed performance concerns, and many users found them distracting (especially if they did not want to upgrade). We are revisiting this UX and will likely bring back the feature in a different form. Until then, best path forward would be to upgrade individual dependencies using the command-line.

@wtask
Copy link
Author

wtask commented Dec 16, 2020

If user do not want to upgrade, why to click an update link? Note, I just really do not understand why cool feature is removed and replaces by strange, blind functionality? Also, if I have to updrade all I will run go get -u ./... under module root and will see all messages from go get. So I could able to resolve any problem if it will happen. Instead the vscode-go and gopls teams make me install additional tools to know which updates are available and manually update them. I like vscode-go very much, but today I have a regression of my workflow.
As for "Upgrade direct dependencies" I only tried to test this function and I'm not planned to add issue report anyway due to "upgrade all" action is always unsafe for me. Will just avoid it.

@stamblerre stamblerre added this to Needs Triage in vscode-go: gopls by default via automation Dec 21, 2020
@stamblerre stamblerre removed this from Needs Triage in vscode-go: gopls by default Jan 6, 2021
@heschi heschi changed the title x/tools/gopls: upgrade direct dependencies does not work x/tools/gopls: re-enable upgrade lenses for individual dependencies Jan 25, 2021
@gopherbot
Copy link

Change https://golang.org/cl/286474 mentions this issue: internal/lsp: re-enable upgrade lenses for individual dependencies

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.6.5 Feb 1, 2021
rinchsan pushed a commit to rinchsan/gosimports that referenced this issue May 30, 2021
In CL 271297, I disabled the constantly-running upgrade check, which
removed the upgrade commands for individual dependencies. This seems to
have been a relatively popular feature. Re-introduce it, but requiring
explicit user interaction.

We now run an upgrade check when the user clicks "Check for upgrades".
Those results are stored on the View and used to show diagnostics on
any requires they apply to. Right now we only check the go.mod the user
has open; in multi-module workspaces it might make sense to check all of
them, but I'm not sure.

Fixes golang/go#42969.

Change-Id: I65205dc99a4fa9daafdb83145b0294b6f3be5336
Reviewed-on: https://go-review.googlesource.com/c/tools/+/286474
Trust: Heschi Kreinick <heschi@google.com>
Run-TryBot: Heschi Kreinick <heschi@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
@golang golang locked and limited conversation to collaborators Feb 1, 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

7 participants