Skip to content

Conversation

@arnested
Copy link

@arnested arnested commented Dec 17, 2025

Description:
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.

Related issue:

Fixes #525.

Check list:

  • Mark if documentation changes are required.
  • Mark if tests were added or updated to cover the changes.

Copilot AI review requested due to automatic review settings December 17, 2025 23:03
@arnested arnested requested a review from a team as a code owner December 17, 2025 23:03
Copy link

Copilot AI left a 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 using makeSemver() before falling back to semver.satisfies(), enabling direct matching of Go-format version specs like 1.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.

Copy link

Copilot AI left a 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.

Copy link

Copilot AI left a 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.
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.

The RC version in the go.mod file cannot be retrieved

1 participant