@@ -88634,7 +88634,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
8863488634 return (mod && mod.__esModule) ? mod : { "default": mod };
8863588635};
8863688636Object.defineProperty(exports, "__esModule", ({ value: true }));
88637- exports.parseGoVersion = exports.addBinToPath = exports.run = void 0;
88637+ exports.convertEnvStringToJson = exports. parseGoVersion = exports.addBinToPath = exports.run = void 0;
8863888638const core = __importStar(__nccwpck_require__(2186));
8863988639const io = __importStar(__nccwpck_require__(7436));
8864088640const installer = __importStar(__nccwpck_require__(2574));
@@ -88682,11 +88682,19 @@ function run() {
8868288682 core.debug(`add bin ${added}`);
8868388683 const goPath = yield io.which('go');
8868488684 const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
88685+ const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
88686+ const goEnvJson = JSON.parse(convertEnvStringToJson(goEnv));
88687+ const parsedGoVersion = parseGoVersion(goVersion);
88688+ // Go versions less that 1.16 do not have the GOVERSION environment variable
88689+ if (semver.lt(parsedGoVersion, '1.16.0')) {
88690+ goEnvJson['GOVERSION'] = 'go' + parsedGoVersion;
88691+ }
88692+ core.info(goVersion);
8868588693 if (cache && (0, cache_utils_1.isCacheFeatureAvailable)()) {
8868688694 const packageManager = 'default';
8868788695 const cacheDependencyPath = core.getInput('cache-dependency-path');
8868888696 try {
88689- yield (0, cache_restore_1.restoreCache)(parseGoVersion(goVersion) , packageManager, cacheDependencyPath);
88697+ yield (0, cache_restore_1.restoreCache)(parsedGoVersion , packageManager, cacheDependencyPath);
8869088698 }
8869188699 catch (error) {
8869288700 core.warning(`Restore cache failed: ${error.message}`);
@@ -88695,11 +88703,12 @@ function run() {
8869588703 // add problem matchers
8869688704 const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
8869788705 core.info(`##[add-matcher]${matchersPath}`);
88698- // output the version actually being used
88699- core.info(goVersion);
88700- core.setOutput('go-version', parseGoVersion(goVersion));
88706+ core.setOutput('go-version', parsedGoVersion);
88707+ core.setOutput('go-path', goEnvJson['GOPATH']);
88708+ core.setOutput('go-cache', goEnvJson['GOCACHE']);
88709+ core.setOutput('go-mod-cache', goEnvJson['GOMODCACHE']);
88710+ core.setOutput('go-env', goEnvJson);
8870188711 core.startGroup('go env');
88702- const goEnv = (child_process_1.default.execSync(`${goPath} env`) || '').toString();
8870388712 core.info(goEnv);
8870488713 core.endGroup();
8870588714 }
@@ -88747,6 +88756,16 @@ function parseGoVersion(versionString) {
8874788756 return versionString.split(' ')[2].slice('go'.length);
8874888757}
8874988758exports.parseGoVersion = parseGoVersion;
88759+ function convertEnvStringToJson(envString) {
88760+ const envArray = envString.split('\n');
88761+ const envObject = {};
88762+ envArray.forEach(envVar => {
88763+ const [key, value] = envVar.split(/=(?=")/);
88764+ envObject[key] = value === null || value === void 0 ? void 0 : value.replace(/"/g, '');
88765+ });
88766+ return JSON.stringify(envObject);
88767+ }
88768+ exports.convertEnvStringToJson = convertEnvStringToJson;
8875088769function resolveVersionInput() {
8875188770 let version = core.getInput('go-version');
8875288771 const versionFilePath = core.getInput('go-version-file');
0 commit comments