Skip to content

Commit

Permalink
Add .tool-versions support
Browse files Browse the repository at this point in the history
  • Loading branch information
dsame committed Jul 27, 2023
1 parent 28cfea2 commit e93a581
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dist/setup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -61599,6 +61599,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;
Expand Down
3 changes: 3 additions & 0 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit e93a581

Please sign in to comment.