-
Notifications
You must be signed in to change notification settings - Fork 632
Add support for rc and beta versions in go.mod file #701
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds support for matching Go versions in rc and beta formats (e.g., 1.14rc1, 1.18beta1) when specified as version inputs. It extends both the regex pattern for parsing go.mod/go.work files and the version matching logic in findMatch().
Key changes:
- Enhanced the regex in
parseGoVersionFile()to recognize beta/rc suffixes in version strings - Modified
findMatch()to perform a strict equality check usingmakeSemver()before falling back tosemver.satisfies(), enabling direct matching of Go-format version specs like1.14rc1 - Added a test case to verify that
findMatch()correctly resolves Go-format rc version specs
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/installer.ts | Extended regex pattern to match beta/rc versions in go directive; added strict equality check in findMatch() for Go-format version specs |
| dist/setup/index.js | Compiled distribution file reflecting the source changes |
| tests/setup-go.test.ts | Added test case for finding pre-release versions using Go version format (1.14rc1) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The regex in `parseGoVersionFile()` didn't consider rc and beta versions. The regex has been extended. In `findMatch()` the match is checked using `semver.satisfies()`. But `semver.satisfies()` doesn't no about Go's non-semver rc and beta version formats (1.16c1 instead of 1.16.0-rc.1). We cannot use `makeSemver()` on `versionSpec` and compare the result using `semver.satisfies()` because `versionSpec` could be, well, a spec. Instead we first check if there is a strict match between the candidate version and the versionSpec. Fixes actions#525.
Description:
The regex in
parseGoVersionFile()didn't consider rc and beta versions. The regex has been extended.In
findMatch()the match is checked usingsemver.satisfies(). Butsemver.satisfies()doesn't no about Go's non-semver rc and beta version formats (1.16c1 instead of 1.16.0-rc.1).We cannot use
makeSemver()onversionSpecand compare the result usingsemver.satisfies()becauseversionSpeccould be, well, a spec. Instead we first check if there is a strict match between the candidate version and the versionSpec.Related issue:
Fixes #525.
Check list: