Skip to content

fix(go): support semver prerelease suffixes in version-go regex#2803

Open
noahdietz wants to merge 1 commit into
googleapis:mainfrom
noahdietz:fix-go-version-regex
Open

fix(go): support semver prerelease suffixes in version-go regex#2803
noahdietz wants to merge 1 commit into
googleapis:mainfrom
noahdietz:fix-go-version-regex

Conversation

@noahdietz
Copy link
Copy Markdown

If the version value in internal/verison.go had a SemVer prerelease suffix with dot separated segments (https://semver.org/#spec-item-9) e.g. 1.2.3-rc.1, the version updater wouldn't match the string and wouldn't update it with the new version.

Discovered this while testing release-please for previews (googleapis/librarian#6115 (comment)), where we expect to use dot-separated prerelease segments.

@noahdietz noahdietz requested review from a team as code owners June 2, 2026 23:14
@product-auto-label product-auto-label Bot added the size: s Pull request size is small. label Jun 2, 2026
@noahdietz noahdietz assigned jskeet and codyoss and unassigned chingor13 Jun 2, 2026
@noahdietz
Copy link
Copy Markdown
Author

Apologies @chingor13 didn't realize automation would assign you. Feel free to review as well if you'd like!

Copy link
Copy Markdown
Contributor

@jskeet jskeet left a comment

Choose a reason for hiding this comment

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

One nit, but basically fine - assuming I actually understand it...

updateContent(content: string): string {
return content.replace(
/const Version = "[0-9]+\.[0-9]+\.[0-9](-\w+)?"/,
/const Version = "[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-.]+)??"/,
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.

Is the second question mark at the end required?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size: s Pull request size is small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants