Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Utilize the .tool-versions file to set expected Go version #402

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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