@@ -88408,7 +88408,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8840888408 return (mod && mod.__esModule) ? mod : { "default": mod };
8840988409};
8841088410Object.defineProperty(exports, "__esModule", ({ value: true }));
88411- exports.parseGoVersion = exports.addBinToPath = exports.run = void 0;
88411+ exports.convertEnvStringToJson = exports. parseGoVersion = exports.addBinToPath = exports.run = void 0;
8841288412const core = __importStar(__nccwpck_require__(2186));
8841388413const io = __importStar(__nccwpck_require__(7436));
8841488414const installer = __importStar(__nccwpck_require__(2574));
@@ -88456,11 +88456,19 @@ function run() {
8845688456 core.debug(`add bin ${added}`);
8845788457 const goPath = yield io.which('go');
8845888458 const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
88459+ const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
88460+ const goEnvJson = JSON.parse(convertEnvStringToJson(goEnv));
88461+ const parsedGoVersion = parseGoVersion(goVersion);
88462+ // Go versions less that 1.16 do not have the GOVERSION environment variable
88463+ if (semver.lt(parsedGoVersion, '1.16.0')) {
88464+ goEnvJson['GOVERSION'] = 'go' + parsedGoVersion;
88465+ }
88466+ core.info(goVersion);
8845988467 if (cache && (0, cache_utils_1.isCacheFeatureAvailable)()) {
8846088468 const packageManager = 'default';
8846188469 const cacheDependencyPath = core.getInput('cache-dependency-path');
8846288470 try {
88463- yield (0, cache_restore_1.restoreCache)(parseGoVersion(goVersion) , packageManager, cacheDependencyPath);
88471+ yield (0, cache_restore_1.restoreCache)(parsedGoVersion , packageManager, cacheDependencyPath);
8846488472 }
8846588473 catch (error) {
8846688474 core.warning(`Restore cache failed: ${error.message}`);
@@ -88469,11 +88477,12 @@ function run() {
8846988477 // add problem matchers
8847088478 const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
8847188479 core.info(`##[add-matcher]${matchersPath}`);
88472- // output the version actually being used
88473- core.info(goVersion);
88474- core.setOutput('go-version', parseGoVersion(goVersion));
88480+ core.setOutput('go-version', parsedGoVersion);
88481+ core.setOutput('go-path', goEnvJson['GOPATH']);
88482+ core.setOutput('go-cache', goEnvJson['GOCACHE']);
88483+ core.setOutput('go-mod-cache', goEnvJson['GOMODCACHE']);
88484+ core.setOutput('go-env', goEnvJson);
8847588485 core.startGroup('go env');
88476- const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
8847788486 core.info(goEnv);
8847888487 core.endGroup();
8847988488 }
@@ -88521,6 +88530,16 @@ function parseGoVersion(versionString) {
8852188530 return versionString.split(' ')[2].slice('go'.length);
8852288531}
8852388532exports.parseGoVersion = parseGoVersion;
88533+ function convertEnvStringToJson(envString) {
88534+ const envArray = envString.split('\n');
88535+ const envObject = {};
88536+ envArray.forEach(envVar => {
88537+ const [key, value] = envVar.split(/=(?=")/);
88538+ envObject[key] = value === null || value === void 0 ? void 0 : value.replace(/"/g, '');
88539+ });
88540+ return JSON.stringify(envObject);
88541+ }
88542+ exports.convertEnvStringToJson = convertEnvStringToJson;
8852488543function resolveVersionInput() {
8852588544 let version = core.getInput('go-version');
8852688545 const versionFilePath = core.getInput('go-version-file');
0 commit comments