Hello guys,
when I run locally or in CircleCI <https://circleci.com/> command `go fix 
./...` it reports this error multiple times:
go fix ./...
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2
invalid -go=go1.22.0
exit status 2

When digging deeper, it shows that the underlying tool is reporting this 
error:
go tool fix -go=go1.22.0 .
invalid -go=go1.22.0

When I omit the path, it works:
go tool fix -go=go1.22 .
(no error, no output)

In source code, it looks like it uses standard go validation for the 
version:
https://github.com/golang/go/blob/b788e91badd523e5bb0fc8d50cd76b8ae04ffb20/src/cmd/fix/main.go#L75

I tried to run this validation in a test and it works:
func Test(t *testing.T) {
require.True(t, version.IsValid("go1.22.0"))
}
// Output
=== RUN   Test
--- PASS: Test (0.00s)
PASS
So I'm confused, why it fails.

Local machine:
Apple M3 Pro
macOS Sonoma (Version 14.5 (23F79))

Installed go is:
go version go1.22.4 darwin/arm64
In go.mod is:
go 1.22.0

toolchain go1.22.4

This tool fails also in the CircleCI, used image is:
cimg/go:1.22 
<https://hub.docker.com/layers/cimg/go/1.22/images/sha256-65725be749b5b1eb60819f4c931944b367695fcdd9dc1b1db90f2eb7eec790fb>
 
where is probably also go1.22.4

Do anybody know why it's happening and how to fix it?
Looks like a bug to me 🤔

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/daa7f469-de6d-4e3f-9d3d-d0a9f64c45d0n%40googlegroups.com.

Reply via email to