mirror of
https://github.com/actions/setup-go.git
synced 2026-06-28 18:55:08 +00:00
Merge 27a670ec1a into e91cc3bfe0
This commit is contained in:
commit
c3a3f3e4ec
4 changed files with 228 additions and 6 deletions
|
|
@ -582,7 +582,10 @@ export async function findMatch(
|
|||
const version = makeSemver(candidate.version);
|
||||
|
||||
core.debug(`check ${version} satisfies ${versionSpec}`);
|
||||
if (semver.satisfies(version, versionSpec)) {
|
||||
if (
|
||||
candidate.version.replace(/^go/, '') === versionSpec ||
|
||||
semver.satisfies(version, versionSpec)
|
||||
) {
|
||||
goFile = candidate.files.find(file => {
|
||||
core.debug(
|
||||
`${file.arch}===${archFilter} && ${file.os}===${platFilter}`
|
||||
|
|
@ -670,7 +673,7 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
|||
}
|
||||
|
||||
// go directive: https://go.dev/ref/mod#go-mod-file-go
|
||||
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||
const matchGo = contents.match(/^go (\d+(\.\d+)*(?:\.\d+|(beta|rc)\d+)?)/m);
|
||||
return matchGo ? matchGo[1] : '';
|
||||
} else if (path.basename(versionFilePath) === '.tool-versions') {
|
||||
const match = contents.match(/^golang\s+([^\n#]+)/m);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue