|
|
|
@ -88634,7 +88634,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
|
|
|
};
|
|
|
|
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
|
|
exports.parseGoVersion = exports.addBinToPath = exports.run = void 0;
|
|
|
|
|
exports.convertEnvStringToJson = exports.parseGoVersion = exports.addBinToPath = exports.run = void 0;
|
|
|
|
|
const core = __importStar(__nccwpck_require__(2186));
|
|
|
|
|
const io = __importStar(__nccwpck_require__(7436));
|
|
|
|
|
const installer = __importStar(__nccwpck_require__(2574));
|
|
|
|
@ -88682,11 +88682,19 @@ function run() {
|
|
|
|
|
core.debug(`add bin ${added}`);
|
|
|
|
|
const goPath = yield io.which('go');
|
|
|
|
|
const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
|
|
|
|
|
const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
|
|
|
|
|
const goEnvJson = JSON.parse(convertEnvStringToJson(goEnv));
|
|
|
|
|
const parsedGoVersion = parseGoVersion(goVersion);
|
|
|
|
|
// Go versions less that 1.16 do not have the GOVERSION environment variable
|
|
|
|
|
if (semver.lt(parsedGoVersion, '1.16.0')) {
|
|
|
|
|
goEnvJson['GOVERSION'] = 'go' + parsedGoVersion;
|
|
|
|
|
}
|
|
|
|
|
core.info(goVersion);
|
|
|
|
|
if (cache && (0, cache_utils_1.isCacheFeatureAvailable)()) {
|
|
|
|
|
const packageManager = 'default';
|
|
|
|
|
const cacheDependencyPath = core.getInput('cache-dependency-path');
|
|
|
|
|
try {
|
|
|
|
|
yield (0, cache_restore_1.restoreCache)(parseGoVersion(goVersion), packageManager, cacheDependencyPath);
|
|
|
|
|
yield (0, cache_restore_1.restoreCache)(parsedGoVersion, packageManager, cacheDependencyPath);
|
|
|
|
|
}
|
|
|
|
|
catch (error) {
|
|
|
|
|
core.warning(`Restore cache failed: ${error.message}`);
|
|
|
|
@ -88695,11 +88703,12 @@ function run() {
|
|
|
|
|
// add problem matchers
|
|
|
|
|
const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
|
|
|
|
|
core.info(`##[add-matcher]${matchersPath}`);
|
|
|
|
|
// output the version actually being used
|
|
|
|
|
core.info(goVersion);
|
|
|
|
|
core.setOutput('go-version', parseGoVersion(goVersion));
|
|
|
|
|
core.setOutput('go-version', parsedGoVersion);
|
|
|
|
|
core.setOutput('go-path', goEnvJson['GOPATH']);
|
|
|
|
|
core.setOutput('go-cache', goEnvJson['GOCACHE']);
|
|
|
|
|
core.setOutput('go-mod-cache', goEnvJson['GOMODCACHE']);
|
|
|
|
|
core.setOutput('go-env', goEnvJson);
|
|
|
|
|
core.startGroup('go env');
|
|
|
|
|
const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
|
|
|
|
|
core.info(goEnv);
|
|
|
|
|
core.endGroup();
|
|
|
|
|
}
|
|
|
|
@ -88747,6 +88756,16 @@ function parseGoVersion(versionString) {
|
|
|
|
|
return versionString.split(' ')[2].slice('go'.length);
|
|
|
|
|
}
|
|
|
|
|
exports.parseGoVersion = parseGoVersion;
|
|
|
|
|
function convertEnvStringToJson(envString) {
|
|
|
|
|
const envArray = envString.split('\n');
|
|
|
|
|
const envObject = {};
|
|
|
|
|
envArray.forEach(envVar => {
|
|
|
|
|
const [key, value] = envVar.split(/=(?=")/);
|
|
|
|
|
envObject[key] = value === null || value === void 0 ? void 0 : value.replace(/"/g, '');
|
|
|
|
|
});
|
|
|
|
|
return JSON.stringify(envObject);
|
|
|
|
|
}
|
|
|
|
|
exports.convertEnvStringToJson = convertEnvStringToJson;
|
|
|
|
|
function resolveVersionInput() {
|
|
|
|
|
let version = core.getInput('go-version');
|
|
|
|
|
const versionFilePath = core.getInput('go-version-file');
|
|
|
|
|