mirror of
https://github.com/actions/setup-go.git
synced 2024-11-15 11:54:34 +08:00
Add .tool-versions support
This commit is contained in:
parent
db8764c1e2
commit
6ecdea2b64
4
dist/setup/index.js
vendored
4
dist/setup/index.js
vendored
@ -61596,6 +61596,10 @@ function parseGoVersionFile(versionFilePath) {
|
|||||||
const match = contents.match(/^go (\d+(\.\d+)*)/m);
|
const match = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||||
return match ? match[1] : '';
|
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();
|
return contents.trim();
|
||||||
}
|
}
|
||||||
exports.parseGoVersionFile = parseGoVersionFile;
|
exports.parseGoVersionFile = parseGoVersionFile;
|
||||||
|
@ -361,6 +361,9 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
|||||||
) {
|
) {
|
||||||
const match = contents.match(/^go (\d+(\.\d+)*)/m);
|
const match = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||||
return match ? match[1] : '';
|
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();
|
return contents.trim();
|
||||||
|
Loading…
Reference in New Issue
Block a user