Ok, I was searching in wrong branch, I found the cause, it's caused by the 
custom 
version parsing 
<https://github.com/golang/go/blob/fe9b3c339978f37aad53875d9e6d2df35a1996ad/src/cmd/fix/main.go#L82>
 
in the 1.22 branch, in the main it's fixed

On Wednesday, June 12, 2024 at 3:54:10 PM UTC+2 David Ševčík wrote:

> 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/7db14153-0201-4c0b-ac69-eb9c6baa0739n%40googlegroups.com.

Reply via email to