npm run build

This commit is contained in:
jojo43 2022-05-01 12:46:11 +09:00
parent 1fefa4e324
commit 676a55b643

18
dist/index.js vendored
View file

@ -2157,11 +2157,17 @@ exports.parseGoVersion = parseGoVersion;
function resolveVersionInput() { function resolveVersionInput() {
let version = core.getInput('go-version'); let version = core.getInput('go-version');
const versionFilePath = core.getInput('go-version-file'); const versionFilePath = core.getInput('go-version-file');
if (version && versionFilePath) {
core.warning('Both go-version and go-version-file inputs are specified, only go-version will be used');
}
if (version) { if (version) {
return version; return version;
} }
if (versionFilePath) { if (versionFilePath) {
version = installer.parseGoVersionFile(fs_1.default.readFileSync(versionFilePath).toString(), path_1.default.basename(versionFilePath) === 'go.mod'); if (!fs_1.default.existsSync(versionFilePath)) {
throw new Error(`The specified go version file at: ${versionFilePath} does not exist`);
}
version = installer.parseGoVersionFile(versionFilePath);
} }
return version; return version;
} }
@ -5912,6 +5918,7 @@ const path = __importStar(__webpack_require__(622));
const semver = __importStar(__webpack_require__(280)); const semver = __importStar(__webpack_require__(280));
const httpm = __importStar(__webpack_require__(539)); const httpm = __importStar(__webpack_require__(539));
const sys = __importStar(__webpack_require__(737)); const sys = __importStar(__webpack_require__(737));
const fs_1 = __importDefault(__webpack_require__(747));
const os_1 = __importDefault(__webpack_require__(87)); const os_1 = __importDefault(__webpack_require__(87));
function getGo(versionSpec, checkLatest, auth) { function getGo(versionSpec, checkLatest, auth) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
@ -6130,13 +6137,14 @@ function makeSemver(version) {
return fullVersion; return fullVersion;
} }
exports.makeSemver = makeSemver; exports.makeSemver = makeSemver;
function parseGoVersionFile(contents, isMod) { function parseGoVersionFile(versionFilePath) {
if (!isMod) { const contents = fs_1.default.readFileSync(versionFilePath).toString();
return contents.trim(); if (path.basename(versionFilePath) === 'go.mod') {
}
const match = contents.match(/^go (\d+(\.\d+)*)/m); const match = contents.match(/^go (\d+(\.\d+)*)/m);
return match ? match[1] : ''; return match ? match[1] : '';
} }
return contents.trim();
}
exports.parseGoVersionFile = parseGoVersionFile; exports.parseGoVersionFile = parseGoVersionFile;
//# sourceMappingURL=installer.js.map //# sourceMappingURL=installer.js.map