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

fix(module): Handle X.Y.Z version format #25

Merged
merged 1 commit into from
Feb 3, 2024

Conversation

abhinav
Copy link
Contributor

@abhinav abhinav commented Feb 2, 2024

Starting Go 1.21, the 'go' directive in go.mod files
takes the form:

go X.Y.Z

(https://go.dev/doc/go1.21)

Given a go.mod file with such a directive,
gimme module fails because it turns "1.21.5" into "1.21.5.x".

This commit fixes the issue by adding the ".x" suffix
only if the version is in the form "X.Y".

As an added bonus, this will also work for pre-releases:

go 1.22rc2

Starting Go 1.21, the 'go' directive in go.mod files
takes the form:

    go X.Y.Z

(https://go.dev/doc/go1.21)

Given a go.mod file with such a directive,
`gimme module` fails because it turns "1.21.5" into "1.21.5.x".

This commit fixes the issue by adding the ".x" suffix
only if the version is in the form "X.Y".

As an added bonus, this will also work for pre-releases:

    go 1.22rc2
Copy link
Member

@tianon tianon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

Copy link
Contributor

@brackendawson brackendawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I thought this behaviour might be a regression, since the go directive is now defined as a strict minimum supported version. I thought it should continue to use the latest patch release as it did before.

However thinking about why this feature was created, to allow one to reliably test a module with it's minimum supported version, then this behaviour is desirable. Thank you.

@brackendawson brackendawson merged commit 975cf32 into urfave:main Feb 3, 2024
19 checks passed
@abhinav abhinav deleted the handle-1.21-versions branch February 3, 2024 23:52
abhinav added a commit to abhinav/gimme that referenced this pull request Feb 6, 2024
abhinav added a commit to abhinav/gimme that referenced this pull request Feb 6, 2024
abhinav added a commit to abhinav/gimme that referenced this pull request Feb 6, 2024
abhinav added a commit to abhinav/gimme that referenced this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants