mirror of
https://github.com/actions/setup-go.git
synced 2025-04-23 17:40:50 +00:00
npm run build
This commit is contained in:
parent
1fefa4e324
commit
676a55b643
1 changed files with 17 additions and 9 deletions
20
dist/index.js
vendored
20
dist/index.js
vendored
|
@ -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,12 +6137,13 @@ 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);
|
||||||
|
return match ? match[1] : '';
|
||||||
}
|
}
|
||||||
const match = contents.match(/^go (\d+(\.\d+)*)/m);
|
return contents.trim();
|
||||||
return match ? match[1] : '';
|
|
||||||
}
|
}
|
||||||
exports.parseGoVersionFile = parseGoVersionFile;
|
exports.parseGoVersionFile = parseGoVersionFile;
|
||||||
//# sourceMappingURL=installer.js.map
|
//# sourceMappingURL=installer.js.map
|
||||||
|
|
Loading…
Add table
Reference in a new issue