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 db8764c commit 6ecdea2
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
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/installer.ts
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 6ecdea2

Please sign in to comment.