mirror of
https://github.com/actions/setup-go.git
synced 2025-12-18 05:37:49 +00:00
Add support for .tool-versions file in setup-go, update workflow (#673)
* setup go in local * add .tool-versions file support
This commit is contained in:
@@ -513,6 +513,9 @@ export function parseGoVersionFile(versionFilePath: string): string {
|
||||
// go directive: https://go.dev/ref/mod#go-mod-file-go
|
||||
const matchGo = contents.match(/^go (\d+(\.\d+)*)/m);
|
||||
return matchGo ? matchGo[1] : '';
|
||||
} else if (path.basename(versionFilePath) === '.tool-versions') {
|
||||
const match = contents.match(/^golang\s+([^\n#]+)/m);
|
||||
return match ? match[1].trim() : '';
|
||||
}
|
||||
|
||||
return contents.trim();
|
||||
|
||||
Reference in New Issue
Block a user