mirror of
https://github.com/actions/setup-go.git
synced 2025-07-24 23:48:28 +02:00
Read go version from go.mod
This commit is contained in:
parent
f5fe54e5a4
commit
55b9afc327
4 changed files with 76 additions and 22 deletions
|
@ -266,3 +266,12 @@ export function makeSemver(version: string): string {
|
|||
|
||||
return `${verPart}${prereleasePart}`;
|
||||
}
|
||||
|
||||
export function parseGoVersionFile(contents: string, isMod: boolean): string {
|
||||
if (!isMod) {
|
||||
return contents.trim();
|
||||
}
|
||||
|
||||
const match = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||
return match ? match[1] : '';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue