run lint and build tasks

This commit is contained in:
plukevdh 2023-05-22 09:41:36 -04:00
parent c401b8cb9d
commit a9bf05db07
No known key found for this signature in database
GPG key ID: 4CDF66F8A7057826
3 changed files with 29 additions and 9 deletions

View file

@ -139,7 +139,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ] os: [ubuntu-latest, windows-latest, macos-latest]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup Go and check latest - name: Setup Go and check latest

28
dist/setup/index.js vendored
View file

@ -61337,7 +61337,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod }; return (mod && mod.__esModule) ? mod : { "default": mod };
}; };
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.resolveStableVersionInput = exports.parseGoVersionFile = exports.makeSemver = exports.getVersionsDist = exports.findMatch = exports.getInfoFromManifest = exports.getManifest = exports.extractGoArchive = exports.getGo = void 0; exports.resolveStableVersionInput = exports.parseToolVersionsFile = exports.parseGoVersionFile = exports.makeSemver = exports.getVersionsDist = exports.findMatch = exports.getInfoFromManifest = exports.getManifest = exports.extractGoArchive = exports.getGo = void 0;
const tc = __importStar(__nccwpck_require__(7784)); const tc = __importStar(__nccwpck_require__(7784));
const core = __importStar(__nccwpck_require__(2186)); const core = __importStar(__nccwpck_require__(2186));
const path = __importStar(__nccwpck_require__(1017)); const path = __importStar(__nccwpck_require__(1017));
@ -61598,6 +61598,12 @@ function parseGoVersionFile(versionFilePath) {
return contents.trim(); return contents.trim();
} }
exports.parseGoVersionFile = parseGoVersionFile; exports.parseGoVersionFile = parseGoVersionFile;
function parseToolVersionsFile(toolVersionsPath) {
const contents = fs_1.default.readFileSync(toolVersionsPath).toString();
const match = contents.match(/^golang (\d+(\.\d+)*)/m);
return match ? match[1] : '';
}
exports.parseToolVersionsFile = parseToolVersionsFile;
function resolveStableVersionDist(versionSpec, arch) { function resolveStableVersionDist(versionSpec, arch) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const archFilter = sys.getArch(arch); const archFilter = sys.getArch(arch);
@ -61794,18 +61800,32 @@ 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) { let toolVersionsPath = core.getInput('tool-versions-file');
core.warning('Both go-version and go-version-file inputs are specified, only go-version will be used'); if (version && (versionFilePath || toolVersionsPath)) {
core.warning('Multiple version inputs are specified, only go-version will be used');
} }
if (version) { if (version) {
return version; return version;
} }
if (versionFilePath) { else if (versionFilePath) {
if (!fs_1.default.existsSync(versionFilePath)) { if (!fs_1.default.existsSync(versionFilePath)) {
throw new Error(`The specified go version file at: ${versionFilePath} does not exist`); throw new Error(`The specified go version file at: ${versionFilePath} does not exist`);
} }
version = installer.parseGoVersionFile(versionFilePath); version = installer.parseGoVersionFile(versionFilePath);
} }
else {
// in the case of no version specification, reach for .tool-versions
if (toolVersionsPath && !fs_1.default.existsSync(toolVersionsPath)) {
throw new Error(`The specified .tool-versions file at ${toolVersionsPath} does not exist`);
}
if (!toolVersionsPath) {
toolVersionsPath = '.tool-versions';
if (!fs_1.default.existsSync(toolVersionsPath)) {
throw new Error(`No .tool-versions file was found in the project path. Please specify using tool-versions-file`);
}
}
version = installer.parseToolVersionsFile(toolVersionsPath);
}
return version; return version;
} }

View file

@ -157,17 +157,17 @@ function resolveVersionInput(): string {
version = installer.parseGoVersionFile(versionFilePath); version = installer.parseGoVersionFile(versionFilePath);
} else { } else {
// in the case of no version specification, reach for .tool-versions // in the case of no version specification, reach for .tool-versions
if(toolVersionsPath && !fs.existsSync(toolVersionsPath)) { if (toolVersionsPath && !fs.existsSync(toolVersionsPath)) {
throw new Error( throw new Error(
`The specified .tool-versions file at ${toolVersionsPath} does not exist` `The specified .tool-versions file at ${toolVersionsPath} does not exist`
); );
} }
if (!toolVersionsPath) { if (!toolVersionsPath) {
toolVersionsPath = '.tool-versions'; toolVersionsPath = '.tool-versions';
if(!fs.existsSync(toolVersionsPath)) { if (!fs.existsSync(toolVersionsPath)) {
throw new Error( throw new Error(
`No .tool-versions file was found in the project path. Please specify using tool-versions-file` `No .tool-versions file was found in the project path. Please specify using tool-versions-file`
); );
} }
} }