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

Using go mod tidy on v1.21+ breaks usage of older Go mod #63370

Closed
andydotxyz opened this issue Oct 4, 2023 · 5 comments
Closed

Using go mod tidy on v1.21+ breaks usage of older Go mod #63370

andydotxyz opened this issue Oct 4, 2023 · 5 comments

Comments

@andydotxyz
Copy link
Contributor

What version of Go are you using (go version)?

v1.21.x

Does this issue reproduce with the latest release?

Use any v1.21 and then compare with any older version (of which many are supported).

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOOS='darwin'
GOARCH='arm64'

What did you do?

  • Using a Go 1.21 or newer call "go mod tidy"
  • Open this project on an earlier Go and call "go mod tidy" again

Command will fail to run

What did you expect to see?

Compatibility

What did you see instead?

go: errors parsing go.mod:
/Users/andy/Code/Fyne/fyne/go.mod:3: invalid go version '1.21.1': must match format 1.23

More

I do not know what can be done here, but this is taking the assertion that a metadata change does not impact the backwards compatibility promise to the extreme.
In one release a new format was introduced in a way that in the prior release it was impossible to use.

Can't we at least have a migration path so that people working on a team do not all have to upgrade at the same time?

@seankhliao
Copy link
Member

In go1.21+ the go directive specifies the minimum version of go necessary to build the project, using a project with an older toolchain and newer go version requirement isn't supported.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Oct 4, 2023
@andydotxyz
Copy link
Contributor Author

Suggestion: Leave in support for x.y.z versions but roll back the forced move to these when module is updating until at least v1.22 (or 1.23 so we do not break mid-support-cycle).

@andydotxyz
Copy link
Contributor Author

In go1.21+ the go directive specifies the minimum version of go necessary to build the project, using a project with an older toolchain and newer go version requirement isn't supported.

I appreciate that there is a reason for this change, however it does lead to situations where go.mod can have "go 1.20.4" in the header and a 1.20 compiler can no longer read the project.

Surely if the "go mod tidy" was doing a complete job of maintaining the compatibility it would see the < 1.21 and trim the .z from the end to ensure compatibility with the version stated?

@andydotxyz
Copy link
Contributor Author

Can you please re-open so we can address the above backwards-incompatibility...

@seankhliao
Copy link
Member

There cannot be go1.20.4, it's not a valid version, and it wouldn't be safe for go to change something it doesn't know about.
Compatibility with older versions during tidy is done using the -go flag

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants