1
0
Fork 0
mirror of https://github.com/actions/setup-go synced 2024-11-09 23:22:41 +00:00

Add .tool-versions support

This commit is contained in:
Sergey Dolin 2023-07-27 19:29:58 +02:00
parent db8764c1e2
commit 6ecdea2b64
2 changed files with 7 additions and 0 deletions

4
dist/setup/index.js vendored
View file

@ -61596,6 +61596,10 @@ function parseGoVersionFile(versionFilePath) {
const match = contents.match(/^go (\d+(\.\d+)*)/m);
return match ? match[1] : '';
}
else if (path.basename(versionFilePath) === '.tool-versions') {
const match = contents.match(/^golang\s+(\d+(\.\d+)*)/m);
return match ? match[1] : '';
}
return contents.trim();
}
exports.parseGoVersionFile = parseGoVersionFile;

View file

@ -361,6 +361,9 @@ export function parseGoVersionFile(versionFilePath: string): string {
) {
const match = contents.match(/^go (\d+(\.\d+)*)/m);
return match ? match[1] : '';
} else if (path.basename(versionFilePath) === '.tool-versions') {
const match = contents.match(/^golang\s+(\d+(\.\d+)*)/m);
return match ? match[1] : '';
}
return contents.trim();