Closed kristoferfannar closed 6 months ago
Unfortunate, but 1.30 is a valid version number, just not one you can use now, and the forward compatibility go aims for prevents it from modifying newer config it potentially doesn't understand.
That's valid. Especially when something like go mod edit -go=0.1
gives the appropriate error.
However, there's something not nice about being able to set a go version to any float above 1.0, such as go mod edit -go=999.999.999
, and have go.mod change to that version.
Go version
go version go1.22.0 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I have a super simple go project (Edit Distance algorithm, ca 100 lines in one main.go) using go.mod with version 1.21. I don't think my code is in any way special or needed for a reproduction.
Anyways, I'm updating my project version 1.22 using
go mod edit
.What did you see happen?
I type
go mod edit -go=1.22
and it looks like everything works.To verify that it actually works, I try
go mod edit -go=1.30
(hoping for an error), and see that go.mod has updated accordingly:Now, I want to go back to version 1.22. I execute
go mod edit -go=1.22
, but get this error message.It now seems to download go version 1.30, exactly when I want to change back to 1.22. What's worse, is that my go.mod hasn't updated, still at
go 1.30
.No matter what I try, I'm stuck at this version.
Finally, when I now run
go version
, I don't get any output. Rather, it retries downloading the first invalid version, 1.30.Only when I manually change the version in go.mod, does everything go back to normal.
What did you expect to see?
When updating to
go mod edit -go=1.30
. I'd expect the error I got later on when switching back to v 1.22.As a result, I would expect the go version in my
go.mod
file not to change to the invalid go version, rather remaining at its prior version.