-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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
Comments
cc @bcmills |
What version of the |
just came across this, to update vscode go tooling:
or just to update golang language server: go install golang.org/x/tools/gopls@latest and you may Ctrl+Shift+P to |
Change https://go.dev/cl/527897 mentions this issue: |
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>
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 |
I am also noticing this occurring in newly go version
go version go1.21.0 linux/amd64
gopls version
golang.org/x/tools/gopls v0.13.2
golang.org/x/tools/gopls@v0.13.2 h1:Pyvx6MKvatbX3zzZmdGiFRfQZl0ohPlt2sFxO/5j6Ro= |
I am also running into this. Similar setup to @optik-aper:
|
Possibly related to #63370? |
For me fixing version in go.mod and go.work to 1.21 didn't resolve the issue :( |
Hrm... should do this for all other modules in a workspace as well Is there currenlt no way to specify the version exactly, like 1.21.3? |
Works around golang/go#61888 Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Stéphane Graber <stgraber@stgraber.org> Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Stéphane Graber <stgraber@stgraber.org> Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Stéphane Graber <stgraber@stgraber.org> Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
This is to workaround golang/go#61888 Signed-off-by: Stéphane Graber <stgraber@stgraber.org> Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
After doing the steps above , you sometimes have to manually close and reopen vscode (even Ctrl+Shift+P then 'Reload Window' doesnt worked for me ) |
``` + cd /home/runner/work/_temp/go/pkg/mod/sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240522175850-2e9781e9fc60 + GOBIN=/home/runner/work/kubezoo/kubezoo/bin go install ./ go: errors parsing go.mod: /home/runner/work/_temp/go/pkg/mod/sigs.k8s.io/controller-runtime/tools/setup-envtest@v0.0.0-20240522175850-2e9781e9fc60/go.mod:3: invalid go version '1.22.0': must match format 1.23 ``` This seems to be fixed by either using older envtest or newer go * golang/go#61888
…h latest staticcheck package(#1633) Go Run staticcheck is failing with the latest go/tools/cmd/staticcheck package https://github.com/dominikh/go-tools/releases/tag/2024.1 with an error - ``` go: honnef.co/go/tools/cmd/staticcheck@latest (in honnef.co/go/tools@v0.5.0): go.mod:3: invalid go version '1.22.1': must match format 1.23 ``` which seems to be not working with the current go version we use, we might need to upgrade go (reference golang/go#61888 (comment)) but for now restricting the static check package to use the last release before the latest i.e. 2023.1.7 https://github.com/dominikh/go-tools/releases/tag/2023.1.7
go: golang.org/x/tools/cmd/goimports@latest (in golang.org/x/tools@v0.27.0): go.mod:3: invalid go version '1.22.0': must match format 1.23 in GH Actions. See golang/go#61888
Sorry to bump and old thread but there's another way to go around it since in my case even a language server restart didn't fix the issue. Instead of forcing gopls version updates, i saw that my vscode itself was using an older go binary (which could very well be why the solution wasn't working for me). I personally use and recommend
[-> echo $GOROOT
/Users/your_username/.gvm/gos/go1.21.5
|
go: golang.org/x/tools/cmd/goimports@latest (in golang.org/x/tools@v0.27.0): go.mod:3: invalid go version '1.22.0': must match format 1.23 in GH Actions. See golang/go#61888
go: golang.org/x/tools/cmd/goimports@latest (in golang.org/x/tools@v0.27.0): go.mod:3: invalid go version '1.22.0': must match format 1.23 in GH Actions. See golang/go#61888
When parsing an invalid
go
line in a go.mod, the error message saysbut that's not strictly true, it doesn't have to match the
1.23
format anymore.The text was updated successfully, but these errors were encountered: