Use const declarations for variables that are never reassigned (#322)

This commit is contained in:
Serghei Iakovlev
2023-01-31 11:46:49 +01:00
committed by GitHub
parent 21459d0b7b
commit 807559307d
4 changed files with 16 additions and 16 deletions

View File

@ -266,14 +266,14 @@ export async function findMatch(
versionSpec: string,
arch = os.arch()
): Promise<IGoVersion | undefined> {
let archFilter = sys.getArch(arch);
let platFilter = sys.getPlatform();
const archFilter = sys.getArch(arch);
const platFilter = sys.getPlatform();
let result: IGoVersion | undefined;
let match: IGoVersion | undefined;
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all';
let candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
dlUrl
);
if (!candidates) {
@ -315,7 +315,7 @@ export async function getVersionsDist(
dlUrl: string
): Promise<IGoVersion[] | null> {
// this returns versions descending so latest is first
let http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
const http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
allowRedirects: true,
maxRedirects: 3
});
@ -372,7 +372,7 @@ async function resolveStableVersionDist(versionSpec: string, arch: string) {
let archFilter = sys.getArch(arch);
let platFilter = sys.getPlatform();
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all';
let candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
dlUrl
);
if (!candidates) {

View File

@ -67,8 +67,8 @@ export async function run() {
core.info(`##[add-matcher]${matchersPath}`);
// output the version actually being used
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();
core.info(goVersion);
core.setOutput('go-version', parseGoVersion(goVersion));