From e671865b850f49017bd3702b62b4b053e8b1315c Mon Sep 17 00:00:00 2001 From: Dmitry Shibanov Date: Tue, 23 Jun 2020 12:34:38 +0300 Subject: [PATCH] fixing path --- dist/index.js | 10 +++++----- src/installer.ts | 6 ++++-- src/main.ts | 3 --- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 67ec000e6..dc769149e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -2528,10 +2528,7 @@ function run() { let token = core.getInput('token'); let auth = !token || isGhes() ? undefined : `token ${token}`; const installDir = yield installer.getGo(versionSpec, stable, auth); - console.log(`installDir is ${installDir}`); core.exportVariable('GOROOT', installDir); - const content = fs_1.default.readdirSync(path_1.default.join(installDir, "go")); - console.log(content); core.addPath(path_1.default.join(installDir, 'bin')); console.log('Added go to the path'); let added = addBinToPath(); @@ -6932,6 +6929,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.makeSemver = exports.getVersionsDist = exports.getInfoFromManifest = exports.findMatch = exports.extractGoArchive = exports.getGo = void 0; const tc = __importStar(__webpack_require__(533)); const core = __importStar(__webpack_require__(470)); +const path = __importStar(__webpack_require__(622)); const semver = __importStar(__webpack_require__(876)); const httpm = __importStar(__webpack_require__(539)); const sys = __importStar(__webpack_require__(737)); @@ -6958,7 +6956,8 @@ function getGo(versionSpec, stable, auth) { info = yield getInfoFromManifest(makeSemver(versionSpec), stable, auth); console.log(`info is ${info}`); if (info) { - downloadPath = yield installGoVersion(info, auth); + const contentPath = yield installGoVersion(info, auth); + downloadPath = yield yield tc.cacheDir(contentPath, 'go', makeSemver(info.resolvedVersion)); } else { console.log('Not found in manifest. Falling back to download directly from Go'); @@ -6984,7 +6983,8 @@ function getGo(versionSpec, stable, auth) { throw new Error(`Unable to find Go version '${versionSpec}' for platform ${osPlat} and architecture ${osArch}.`); } try { - downloadPath = yield installGoVersion(info, undefined); + const contentDir = yield installGoVersion(info, undefined); + downloadPath = yield tc.cacheDir(path.join(contentDir, "go"), 'go', makeSemver(info.resolvedVersion)); } catch (err) { throw new Error(`Failed to download version ${versionSpec}: ${err}`); diff --git a/src/installer.ts b/src/installer.ts index 22338a1ae..bc3526688 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -53,7 +53,8 @@ export async function getGo( info = await getInfoFromManifest(makeSemver(versionSpec), stable, auth); console.log(`info is ${info}`); if (info) { - downloadPath = await installGoVersion(info, auth); + const contentPath = await installGoVersion(info, auth); + downloadPath = await await tc.cacheDir(contentPath, 'go', makeSemver(info.resolvedVersion)); } else { console.log( 'Not found in manifest. Falling back to download directly from Go' @@ -86,7 +87,8 @@ export async function getGo( } try { - downloadPath = await installGoVersion(info, undefined); + const contentDir = await installGoVersion(info, undefined); + downloadPath = await tc.cacheDir(path.join(contentDir, "go"), 'go', makeSemver(info.resolvedVersion)); } catch (err) { throw new Error(`Failed to download version ${versionSpec}: ${err}`); } diff --git a/src/main.ts b/src/main.ts index c3d4db305..662e550b1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -29,10 +29,7 @@ export async function run() { const installDir = await installer.getGo(versionSpec, stable, auth); - console.log(`installDir is ${installDir}`) core.exportVariable('GOROOT', installDir); - const content = fs.readdirSync(path.join(installDir, "go")); - console.log(content); core.addPath(path.join(installDir, 'bin')); console.log('Added go to the path');