mirror of
https://gitea.com/actions/setup-go.git
synced 2024-11-24 21:15:38 +01:00
create profiles go dir if go installed but not exists
This commit is contained in:
parent
93ddff5bef
commit
4e8106ca18
12
dist/index.js
vendored
12
dist/index.js
vendored
@ -1331,7 +1331,7 @@ function addBinToPath() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let added = false;
|
||||
let g = yield io.which('go');
|
||||
core.debug(`which go :${g};`);
|
||||
core.debug(`which go :${g}:`);
|
||||
if (!g) {
|
||||
core.debug('go not in the path');
|
||||
return added;
|
||||
@ -1340,7 +1340,11 @@ function addBinToPath() {
|
||||
if (buf) {
|
||||
let gp = buf.toString().trim();
|
||||
core.debug(`go env GOPATH :${gp}:`);
|
||||
if (fs.existsSync(gp)) {
|
||||
if (!fs.existsSync(gp)) {
|
||||
// some of the hosted images have go install but not profile dir
|
||||
core.debug(`creating ${gp}`);
|
||||
io.mkdirP(gp);
|
||||
}
|
||||
let bp = path.join(gp, 'bin');
|
||||
if (!fs.existsSync(bp)) {
|
||||
core.debug(`creating ${bp}`);
|
||||
@ -1349,10 +1353,6 @@ function addBinToPath() {
|
||||
core.addPath(bp);
|
||||
added = true;
|
||||
}
|
||||
else {
|
||||
core.debug('go env GOPATH does not exist');
|
||||
}
|
||||
}
|
||||
return added;
|
||||
});
|
||||
}
|
||||
|
12
src/main.ts
12
src/main.ts
@ -63,7 +63,7 @@ export async function run() {
|
||||
async function addBinToPath(): Promise<boolean> {
|
||||
let added = false;
|
||||
let g = await io.which('go');
|
||||
core.debug(`which go :${g};`);
|
||||
core.debug(`which go :${g}:`);
|
||||
if (!g) {
|
||||
core.debug('go not in the path');
|
||||
return added;
|
||||
@ -73,7 +73,12 @@ async function addBinToPath(): Promise<boolean> {
|
||||
if (buf) {
|
||||
let gp = buf.toString().trim();
|
||||
core.debug(`go env GOPATH :${gp}:`);
|
||||
if (fs.existsSync(gp)) {
|
||||
if (!fs.existsSync(gp)) {
|
||||
// some of the hosted images have go install but not profile dir
|
||||
core.debug(`creating ${gp}`);
|
||||
io.mkdirP(gp);
|
||||
}
|
||||
|
||||
let bp = path.join(gp, 'bin');
|
||||
if (!fs.existsSync(bp)) {
|
||||
core.debug(`creating ${bp}`);
|
||||
@ -82,9 +87,6 @@ async function addBinToPath(): Promise<boolean> {
|
||||
|
||||
core.addPath(bp);
|
||||
added = true;
|
||||
} else {
|
||||
core.debug('go env GOPATH does not exist');
|
||||
}
|
||||
}
|
||||
return added;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user