Skip to content

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

Merged
brackendawson merged 1 commit into
urfave:mainfrom
abhinav:handle-1.21-versions
Feb 3, 2024
Merged

fix(module): Handle X.Y.Z version format#25
brackendawson merged 1 commit into
urfave:mainfrom
abhinav:handle-1.21-versions

Conversation

@abhinav

@abhinav abhinav commented Feb 2, 2024

Copy link
Copy Markdown
Contributor

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
@abhinav abhinav force-pushed the handle-1.21-versions branch from 2a0a55b to 3f9da19 Compare February 2, 2024 23:02

@tianon tianon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

👀

@brackendawson brackendawson left a comment

Copy link
Copy Markdown
Contributor

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
@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.

3 participants