@@ -63557,7 +63557,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
6355763557 return (mod && mod.__esModule) ? mod : { "default": mod };
6355863558};
6355963559Object.defineProperty(exports, "__esModule", ({ value: true }));
63560- exports.parseGoVersion = exports.addBinToPath = exports.run = void 0;
63560+ exports.convertEnvStringToJson = exports. parseGoVersion = exports.addBinToPath = exports.run = void 0;
6356163561const core = __importStar(__nccwpck_require__(2186));
6356263562const io = __importStar(__nccwpck_require__(7436));
6356363563const installer = __importStar(__nccwpck_require__(2574));
@@ -63602,19 +63602,29 @@ function run() {
6360263602 }
6360363603 const goPath = yield io.which('go');
6360463604 const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
63605+ const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
63606+ const goEnvJson = JSON.parse(convertEnvStringToJson(goEnv));
63607+ const parsedGoVersion = parseGoVersion(goVersion);
63608+ // Go versions less that 1.16 do not have the GOVERSION environment variable
63609+ if (semver.lt(parsedGoVersion, '1.16.0')) {
63610+ goEnvJson['GOVERSION'] = 'go' + parsedGoVersion;
63611+ }
63612+ core.info(goVersion);
6360563613 if (cache && cache_utils_1.isCacheFeatureAvailable()) {
6360663614 const packageManager = 'default';
6360763615 const cacheDependencyPath = core.getInput('cache-dependency-path');
63608- yield cache_restore_1.restoreCache(parseGoVersion(goVersion) , packageManager, cacheDependencyPath);
63616+ yield cache_restore_1.restoreCache(parsedGoVersion , packageManager, cacheDependencyPath);
6360963617 }
6361063618 // add problem matchers
6361163619 const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
6361263620 core.info(`##[add-matcher]${matchersPath}`);
63613- // output the version actually being used
63614- core.info(goVersion);
63615- core.setOutput('go-version', parseGoVersion(goVersion));
63621+ core.setOutput('go-version', parsedGoVersion);
63622+ core.setOutput('go-path', goEnvJson['GOPATH']);
63623+ core.setOutput('go-root', goEnvJson['GOROOT']);
63624+ core.setOutput('go-cache', goEnvJson['GOCACHE']);
63625+ core.setOutput('go-mod-cache', goEnvJson['GOMODCACHE']);
63626+ core.setOutput('go-env', goEnvJson);
6361663627 core.startGroup('go env');
63617- const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
6361863628 core.info(goEnv);
6361963629 core.endGroup();
6362063630 }
@@ -63662,6 +63672,16 @@ function parseGoVersion(versionString) {
6366263672 return versionString.split(' ')[2].slice('go'.length);
6366363673}
6366463674exports.parseGoVersion = parseGoVersion;
63675+ function convertEnvStringToJson(envString) {
63676+ const envArray = envString.split('\n');
63677+ const envObject = {};
63678+ envArray.forEach(envVar => {
63679+ const [key, value] = envVar.split(/=(?=")/);
63680+ envObject[key] = value === null || value === void 0 ? void 0 : value.replace(/"/g, '');
63681+ });
63682+ return JSON.stringify(envObject);
63683+ }
63684+ exports.convertEnvStringToJson = convertEnvStringToJson;
6366563685function resolveVersionInput() {
6366663686 let version = core.getInput('go-version');
6366763687 const versionFilePath = core.getInput('go-version-file');
0 commit comments