-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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: suggest go.mod go version update if generics code is found #51086
Comments
I agree! For context, the types2 error message directly suggests checking But we can recognize the error code, extract the go version regexp from the error message, find the relevant go.mod file, and offer a quickfix to do the mod edit. |
Change https://go.dev/cl/386875 mentions this issue: |
Adds a command to run go mod edit -go to allow users to easily upgrade their go directive. Doing this change also revealed that changing the go directive does not invalidate the type check data and there may be stale diagnostics for a package. Updates golang/go#51086 Change-Id: I659a216059c489a88e29cd51b944c3a0274f3700 Reviewed-on: https://go-review.googlesource.com/c/tools/+/386875 Trust: Suzy Mueller <[email protected]> Run-TryBot: Suzy Mueller <[email protected]> Reviewed-by: Robert Findley <[email protected]> gopls-CI: kokoro <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
@suzmue is there anything left to do here? |
Change https://go.dev/cl/390615 mentions this issue: |
gopls version
go version
go version go1.18beta2 darwin/amd64
What did you do?
copy/pasted generics code but forgot to update go.mod go version (and kept go1.17)
What did you expect to see?
Message indicating go.mod needs update.
What did you see instead?
Message that I need go1.18. That's true, but can be confusing for some users.
Quickfix that updates go.mod version string will be a big plus!
Logs
Gopls is correctly using go1.18beta2.
The text was updated successfully, but these errors were encountered: