From fdc0d672a12b8fc05ef4c549c3fd5b0f03ebeb4c Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 14 Mar 2023 16:29:10 +0100 Subject: [PATCH] Add Go bin if go-version input is empty (#351) --- dist/setup/index.js | 4 ++-- src/main.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index f04942e..f298d5c 100644 --- a/dist/setup/index.js +++ b/dist/setup/index.js @@ -63605,13 +63605,13 @@ function run() { core.info('Setting GOROOT for Go version < 1.9'); core.exportVariable('GOROOT', installDir); } - const added = yield addBinToPath(); - core.debug(`add bin ${added}`); core.info(`Successfully set up Go version ${versionSpec}`); } else { core.info('[warning]go-version input was not specified. The action will try to use pre-installed version.'); } + const added = yield addBinToPath(); + core.debug(`add bin ${added}`); const goPath = yield io.which('go'); const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString(); if (cache && cache_utils_1.isCacheFeatureAvailable()) { diff --git a/src/main.ts b/src/main.ts index d145818..d3fb857 100644 --- a/src/main.ts +++ b/src/main.ts @@ -51,8 +51,6 @@ export async function run() { core.exportVariable('GOROOT', installDir); } - const added = await addBinToPath(); - core.debug(`add bin ${added}`); core.info(`Successfully set up Go version ${versionSpec}`); } else { core.info( @@ -60,6 +58,9 @@ export async function run() { ); } + const added = await addBinToPath(); + core.debug(`add bin ${added}`); + const goPath = await io.which('go'); const goVersion = (cp.execSync(`${goPath} version`) || '').toString();