1
0
Fork 0
mirror of https://code.forgejo.org/actions/setup-go synced 2025-06-17 23:56:05 +02:00

Add and configure ESLint and update configuration for Prettier (#341)

* Turn on ESLint and update Prettier

* Update eslint config

* Update eslint config

* Update dependencies

* Update ESLint and Prettier configurations

* update package.json

* Update prettier command

* Update prettier config file

* Change CRLF to LF

* Update docs

* Update docs
This commit is contained in:
Ivan 2023-03-08 10:45:16 +02:00 committed by GitHub
parent a3d889c34c
commit 7406d654ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 2315 additions and 204 deletions

View file

@ -27,8 +27,8 @@ export async function run() {
}
if (versionSpec) {
let token = core.getInput('token');
let auth = !token ? undefined : `token ${token}`;
const token = core.getInput('token');
const auth = !token ? undefined : `token ${token}`;
const checkLatest = core.getBooleanInput('check-latest');
@ -51,13 +51,13 @@ export async function run() {
core.exportVariable('GOROOT', installDir);
}
let added = await addBinToPath();
const added = await addBinToPath();
core.debug(`add bin ${added}`);
core.info(`Successfully set up Go version ${versionSpec}`);
}
let goPath = await io.which('go');
let goVersion = (cp.execSync(`${goPath} version`) || '').toString();
const goPath = await io.which('go');
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
if (cache && isCacheFeatureAvailable()) {
const packageManager = 'default';
@ -79,7 +79,7 @@ export async function run() {
core.setOutput('go-version', parseGoVersion(goVersion));
core.startGroup('go env');
let goEnv = (cp.execSync(`${goPath} env`) || '').toString();
const goEnv = (cp.execSync(`${goPath} env`) || '').toString();
core.info(goEnv);
core.endGroup();
} catch (error) {
@ -89,16 +89,16 @@ export async function run() {
export async function addBinToPath(): Promise<boolean> {
let added = false;
let g = await io.which('go');
const g = await io.which('go');
core.debug(`which go :${g}:`);
if (!g) {
core.debug('go not in the path');
return added;
}
let buf = cp.execSync('go env GOPATH');
const buf = cp.execSync('go env GOPATH');
if (buf.length > 1) {
let gp = buf.toString().trim();
const gp = buf.toString().trim();
core.debug(`go env GOPATH :${gp}:`);
if (!fs.existsSync(gp)) {
// some of the hosted images have go install but not profile dir
@ -106,7 +106,7 @@ export async function addBinToPath(): Promise<boolean> {
await io.mkdirP(gp);
}
let bp = path.join(gp, 'bin');
const bp = path.join(gp, 'bin');
if (!fs.existsSync(bp)) {
core.debug(`creating ${bp}`);
await io.mkdirP(bp);