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

cmd/go, x/mod: "invalid go version" message mentions old version format #61888

Open
dominikh opened this issue Aug 9, 2023 · 5 comments
Open
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@dominikh
Copy link
Member

dominikh commented Aug 9, 2023

When parsing an invalid go line in a go.mod, the error message says

go: errors parsing go.mod:
go.mod:3: invalid go version '1.22foo': must match format 1.23

but that's not strictly true, it doesn't have to match the 1.23 format anymore.

@seankhliao seankhliao added NeedsFix The path to resolution is known, but the work has not been done. GoCommand cmd/go labels Aug 9, 2023
@seankhliao
Copy link
Member

cc @bcmills

@jamietanna
Copy link

jamietanna commented Sep 8, 2023

What version of the go CLI was this with? I've hit this this morning when using gopls that's been compiled with a pre-1.21 go. The solution was to upgrade go.

@vincenthsh
Copy link

just came across this, to update vscode go tooling:

  1. Press Ctrl+Shift+P
  2. Select Go: Install/Update tools

or just to update golang language server:

go install golang.org/x/tools/gopls@latest

and you may Ctrl+Shift+P to restart language server

@gopherbot
Copy link

Change https://go.dev/cl/527897 mentions this issue: modfile: use new go version string format in error message

gopherbot pushed a commit to golang/mod that referenced this issue Sep 14, 2023
For golang/go#61888

Change-Id: If4056623471edb6fd99d45dcd8a0751d6a54ce1c
Reviewed-on: https://go-review.googlesource.com/c/mod/+/527897
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
@amrojjeh
Copy link

I just got this error message recently after I updated go. I updated gopls as well and that did not fix it. For now I've manually edited the version number to be 1.21 rather than 1.21.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GoCommand cmd/go NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

7 participants