golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.78k stars 727 forks source link

Show a pop-up to help returning users upgrade their environments #3418

Closed stamblerre closed 3 weeks ago

stamblerre commented 3 weeks ago

Hi Tools team šŸ˜„ ā¤ļø

I was just trying to use Go for a personal project, and I had a very old version of Go and of gopls installed on my computer. The version of Go was actually so old that it wouldn't build gopls, and I kept getting this error message:

go install -v golang.org/x/tools/gopls@latest
package golang.org/x/tools/gopls
    imports golang.org/x/tools/gopls/internal/cmd
    imports golang.org/x/tools/gopls/internal/vulncheck/scan: build constraints exclude all Go files in /Users/rstambler/code/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/vulncheck/scan
package golang.org/x/tools/gopls
    imports golang.org/x/tools/gopls/internal/cmd
    imports golang.org/x/tools/gopls/internal/cache
    imports golang.org/x/tools/gopls/internal/vulncheck/semver: build constraints exclude all Go files in /Users/rstambler/code/pkg/mod/golang.org/x/tools/gopls@v0.15.3/internal/vulncheck/semver

At this point, I imagine there are many people out there who have installed some old version of Go, and they might be frustrated if they try Go again some years later. I wonder if there isn't a way for VS Code to come up with an alert that say something like "Welcome back! Your version of Go is no longer supported. Click here to update to the latest version and rebuild all of your Go tools." or something like that.

Hope this isn't a duplicate issue & excited to play with the latest version of all these great tools! šŸ˜„

adonovan commented 3 weeks ago

Welcome back from the wilderness, Rebecca!

findleyr commented 3 weeks ago

Another option here would be to have a main_outdated.go file that produces a more useful error, such as undefined: THIS_GO_VERSION_IS_UNSUPPORTED.

However, forward compatibility means that this is only an issue for users of Go versions older than 1.21 (Rebecca: starting in a few weeks we're going to be able to require the latest version of Go to build gopls!

So the particular problem of upgrading gopls will become less and less severe over time. @hyangah doesn't the extension already prompt users to upgrade Go? I wonder if it is sufficient to improve that popup?

findleyr commented 3 weeks ago

We discussed in our triage meeting (started by you!) and decided this is not worth doing, thanks to the forward compatibility mentioned above (requested by you!).

hyangah commented 3 weeks ago

@hyangah doesn't the extension already prompt users to upgrade Go? I wonder if it is sufficient to improve that popup?

It sounds like since there was an old gopls that was compatible with the old go, there was no problem the extension should report. But when trying to upgrade or reinstall gopls, the old go version wasn't compatible with the latest gopls. The latest version of extension still allowed go1.18 for tools installation (this bug was fixed in the master, but we didn't release the extension with the fix)

I agree that once the extension stops allowing go1.20 or older (#3411), this isn't worth doing.