mirror of
https://github.com/actions/setup-go.git
synced 2025-07-01 13:43:44 +00:00
Add go-version to action outputs
This provides the semver version of Go that has been installed. This is useful if only a major or minor version has been provided as the input go-version value.
This commit is contained in:
parent
bf7ccf173e
commit
2930331465
3 changed files with 17 additions and 1 deletions
6
dist/index.js
vendored
6
dist/index.js
vendored
|
@ -2100,6 +2100,12 @@ function run() {
|
|||
let goPath = yield io.which('go');
|
||||
let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
|
||||
core.info(goVersion);
|
||||
// get the installed version as an Action output
|
||||
// based on go/src/cmd/go/internal/version/version.go:
|
||||
// fmt.Printf("go version %s %s/%s\n", runtime.Version(), runtime.GOOS, runtime.GOARCH)
|
||||
// expecting go<version> for runtime.Version()
|
||||
let goVersionOutput = [...goVersion.split(' ')[2]].slice(2).join('');
|
||||
core.setOutput('go-version', goVersionOutput);
|
||||
core.startGroup('go env');
|
||||
let goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
|
||||
core.info(goEnv);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue