Skip to content

Commit

Permalink
fix building
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Shibanov committed Jun 23, 2020
1 parent 20646b8 commit e7884ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6953,9 +6953,8 @@ function getGo(versionSpec, stable, auth) {
//
try {
info = yield getInfoFromManifest(makeSemver(versionSpec), stable, auth);
console.log(`info is ${info}`);
if (info) {
downloadPath = yield installGoVersion(info, auth);
downloadPath = yield installGoVersion(info, auth, undefined);
}
else {
console.log('Not found in manifest. Falling back to download directly from Go');
Expand All @@ -6981,7 +6980,7 @@ 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);
downloadPath = yield installGoVersion(info, undefined, 'go');
}
catch (err) {
throw new Error(`Failed to download version ${versionSpec}: ${err}`);
Expand All @@ -6991,12 +6990,12 @@ function getGo(versionSpec, stable, auth) {
});
}
exports.getGo = getGo;
function installGoVersion(info, auth) {
function installGoVersion(info, auth, subDir) {
return __awaiter(this, void 0, void 0, function* () {
console.log(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
const downloadPath = yield tc.downloadTool(info.downloadUrl, undefined, auth);
console.log('Extracting Go...');
const extPath = yield extractGoArchive(downloadPath);
let extPath = yield extractGoArchive(downloadPath);
console.log('Adding to the cache ...');
return yield tc.cacheDir(extPath, 'go', makeSemver(info.resolvedVersion));
});
Expand Down
10 changes: 5 additions & 5 deletions src/installer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,8 @@ export async function getGo(
//
try {
info = await getInfoFromManifest(makeSemver(versionSpec), stable, auth);
console.log(`info is ${info}`);
if (info) {
downloadPath = await installGoVersion(info, auth);
downloadPath = await installGoVersion(info, auth, undefined);
} else {
console.log(
'Not found in manifest. Falling back to download directly from Go'
Expand Down Expand Up @@ -86,7 +85,7 @@ export async function getGo(
}

try {
downloadPath = await installGoVersion(info, undefined);
downloadPath = await installGoVersion(info, undefined, 'go');
} catch (err) {
throw new Error(`Failed to download version ${versionSpec}: ${err}`);
}
Expand All @@ -97,13 +96,14 @@ export async function getGo(

async function installGoVersion(
info: IGoVersionInfo,
auth: string | undefined
auth: string | undefined,
subDir: string | undefined
): Promise<string> {
console.log(`Acquiring ${info.resolvedVersion} from ${info.downloadUrl}`);
const downloadPath = await tc.downloadTool(info.downloadUrl, undefined, auth);

console.log('Extracting Go...');
const extPath = await extractGoArchive(downloadPath);
let extPath = await extractGoArchive(downloadPath);

console.log('Adding to the cache ...');
return await tc.cacheDir(extPath, 'go', makeSemver(info.resolvedVersion));
Expand Down

0 comments on commit e7884ed

Please sign in to comment.