Skip to content

Commit

Permalink
fixing path
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Shibanov committed Jun 23, 2020
1 parent c932c47 commit e671865
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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));
Expand All @@ -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');
Expand All @@ -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}`);
Expand Down
6 changes: 4 additions & 2 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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}`);
}
Expand Down
3 changes: 0 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit e671865

Please sign in to comment.