@@ -93565,7 +93565,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
9356593565 return (mod && mod.__esModule) ? mod : { "default": mod };
9356693566};
9356793567Object.defineProperty(exports, "__esModule", ({ value: true }));
93568- exports.parseGoVersion = exports.addBinToPath = exports.run = void 0;
93568+ exports.convertEnvStringToJson = exports. parseGoVersion = exports.addBinToPath = exports.run = void 0;
9356993569const core = __importStar(__nccwpck_require__(2186));
9357093570const io = __importStar(__nccwpck_require__(7436));
9357193571const installer = __importStar(__nccwpck_require__(2574));
@@ -93613,11 +93613,19 @@ function run() {
9361393613 core.debug(`add bin ${added}`);
9361493614 const goPath = yield io.which('go');
9361593615 const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
93616+ const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
93617+ const goEnvJson = JSON.parse(convertEnvStringToJson(goEnv));
93618+ const parsedGoVersion = parseGoVersion(goVersion);
93619+ // Go versions less that 1.16 do not have the GOVERSION environment variable
93620+ if (semver.lt(parsedGoVersion, '1.16.0')) {
93621+ goEnvJson['GOVERSION'] = 'go' + parsedGoVersion;
93622+ }
93623+ core.info(goVersion);
9361693624 if (cache && (0, cache_utils_1.isCacheFeatureAvailable)()) {
9361793625 const packageManager = 'default';
9361893626 const cacheDependencyPath = core.getInput('cache-dependency-path');
9361993627 try {
93620- yield (0, cache_restore_1.restoreCache)(parseGoVersion(goVersion) , packageManager, cacheDependencyPath);
93628+ yield (0, cache_restore_1.restoreCache)(parsedGoVersion , packageManager, cacheDependencyPath);
9362193629 }
9362293630 catch (error) {
9362393631 core.warning(`Restore cache failed: ${error.message}`);
@@ -93626,11 +93634,12 @@ function run() {
9362693634 // add problem matchers
9362793635 const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
9362893636 core.info(`##[add-matcher]${matchersPath}`);
93629- // output the version actually being used
93630- core.info(goVersion);
93631- core.setOutput('go-version', parseGoVersion(goVersion));
93637+ core.setOutput('go-version', parsedGoVersion);
93638+ core.setOutput('go-path', goEnvJson['GOPATH']);
93639+ core.setOutput('go-cache', goEnvJson['GOCACHE']);
93640+ core.setOutput('go-mod-cache', goEnvJson['GOMODCACHE']);
93641+ core.setOutput('go-env', goEnvJson);
9363293642 core.startGroup('go env');
93633- const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
9363493643 core.info(goEnv);
9363593644 core.endGroup();
9363693645 }
@@ -93678,6 +93687,16 @@ function parseGoVersion(versionString) {
9367893687 return versionString.split(' ')[2].slice('go'.length);
9367993688}
9368093689exports.parseGoVersion = parseGoVersion;
93690+ function convertEnvStringToJson(envString) {
93691+ const envArray = envString.split('\n');
93692+ const envObject = {};
93693+ envArray.forEach(envVar => {
93694+ const [key, value] = envVar.split(/=(?=")/);
93695+ envObject[key] = value === null || value === void 0 ? void 0 : value.replace(/"/g, '');
93696+ });
93697+ return JSON.stringify(envObject);
93698+ }
93699+ exports.convertEnvStringToJson = convertEnvStringToJson;
9368193700function resolveVersionInput() {
9368293701 let version = core.getInput('go-version');
9368393702 const versionFilePath = core.getInput('go-version-file');
0 commit comments