From 645f9ad30b6ae0bfa6e82d903b53271f4205fe10 Mon Sep 17 00:00:00 2001 From: Yuri Norwood <106889957+norwd@users.noreply.github.com> Date: Mon, 7 Nov 2022 10:26:17 +1300 Subject: [PATCH] Replace GOPATH with system dependent lib path Signed-off-by: Yuri Norwood <106889957+norwd@users.noreply.github.com> --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 1e19ce4..9a68435 100644 --- a/index.js +++ b/index.js @@ -12,8 +12,8 @@ async function downloadRelease(octokit, os, org, repo, release, token) { const postfix = `_${os}_amd64.${os === "windows" ? "zip" : "tar.gz"}`; const tempdir = os === "windows" ? process.env.TEMP : "/tmp"; - const gopath = process.env.GOPATH + "/bin"; - const extract = "tar -xvzf"; + const libpath = os === "windows" ? process.env.USERPROFILE : "/usr/local"; + const extract = os === "windows" ? "tar -xvf " : "tar -xvzf"; for (let asset of releaseAssets.data) { @@ -28,7 +28,7 @@ async function downloadRelease(octokit, os, org, repo, release, token) { } console.log("Unpacking archive file...") - execSync(`cd ${gopath} && ${extract} ${tempdir}/gotestfmt${postfix}`) + execSync(`cd ${libpath}/bin && ${extract} ${tempdir}/gotestfmt${postfix}`) console.log("Removing asset archive...") fs.unlinkSync(`${tempdir}/gotestfmt${postfix}`)