Solve conflicts

This commit is contained in:
CrazyMax 2020-02-11 16:33:09 +01:00
parent c837c2218b
commit 7fb5bea2dd
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
3 changed files with 281 additions and 222 deletions

34
dist/index.js vendored
View file

@ -1279,6 +1279,7 @@ const core = __importStar(__webpack_require__(470));
const tc = __importStar(__webpack_require__(533)); const tc = __importStar(__webpack_require__(533));
const installer = __importStar(__webpack_require__(749)); const installer = __importStar(__webpack_require__(749));
const path = __importStar(__webpack_require__(622)); const path = __importStar(__webpack_require__(622));
const system = __importStar(__webpack_require__(737));
function run() { function run() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
@ -1302,6 +1303,16 @@ function run() {
core.exportVariable('GOROOT', installDir); core.exportVariable('GOROOT', installDir);
core.addPath(path.join(installDir, 'bin')); core.addPath(path.join(installDir, 'bin'));
console.log('Added go to the path'); console.log('Added go to the path');
// set GOPATH and GOBIN as user value
const goPath = system.getGoPath();
if (goPath) {
core.exportVariable('GOPATH', goPath);
core.addPath(path.join(goPath, 'bin'));
}
const goBin = process.env['GOBIN'] || '';
if (goBin) {
core.exportVariable('GOBIN', goBin);
}
} }
else { else {
throw new Error(`Could not find a version that satisfied version spec: ${versionSpec}`); throw new Error(`Could not find a version that satisfied version spec: ${versionSpec}`);
@ -4510,8 +4521,16 @@ module.exports = bytesToUuid;
"use strict"; "use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
let os = __webpack_require__(87); const os = __importStar(__webpack_require__(87));
const path = __importStar(__webpack_require__(622));
function getPlatform() { function getPlatform() {
// darwin and linux match already // darwin and linux match already
// freebsd not supported yet but future proofed. // freebsd not supported yet but future proofed.
@ -4543,6 +4562,19 @@ function getArch() {
return arch; return arch;
} }
exports.getArch = getArch; exports.getArch = getArch;
// Get GOPATH as user value or as defined by https://golang.org/doc/code.html#GOPATH
function getGoPath() {
const home = process.env['HOME'] || '';
const goPath = process.env['GOPATH'] || '';
if (goPath) {
return goPath;
}
else if (home) {
return path.join(home, 'go');
}
return '';
}
exports.getGoPath = getGoPath;
/***/ }), /***/ }),

View file

@ -2,6 +2,7 @@ import * as core from '@actions/core';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import * as installer from './installer'; import * as installer from './installer';
import * as path from 'path'; import * as path from 'path';
import * as system from './system';
export async function run() { export async function run() {
try { try {
@ -34,6 +35,17 @@ export async function run() {
core.exportVariable('GOROOT', installDir); core.exportVariable('GOROOT', installDir);
core.addPath(path.join(installDir, 'bin')); core.addPath(path.join(installDir, 'bin'));
console.log('Added go to the path'); console.log('Added go to the path');
// set GOPATH and GOBIN as user value
const goPath: string = system.getGoPath();
if (goPath) {
core.exportVariable('GOPATH', goPath);
core.addPath(path.join(goPath, 'bin'));
}
const goBin: string = process.env['GOBIN'] || '';
if (goBin) {
core.exportVariable('GOBIN', goBin);
}
} else { } else {
throw new Error( throw new Error(
`Could not find a version that satisfied version spec: ${versionSpec}` `Could not find a version that satisfied version spec: ${versionSpec}`

View file

@ -1,4 +1,5 @@
let os = require('os'); import * as os from 'os';
import * as path from 'path';
export function getPlatform(): string { export function getPlatform(): string {
// darwin and linux match already // darwin and linux match already
@ -35,3 +36,17 @@ export function getArch(): string {
return arch; return arch;
} }
// Get GOPATH as user value or as defined by https://golang.org/doc/code.html#GOPATH
export function getGoPath(): string {
const home: string = process.env['HOME'] || '';
const goPath: string = process.env['GOPATH'] || '';
if (goPath) {
return goPath;
} else if (home) {
return path.join(home, 'go');
}
return '';
}