Skip to content

Commit 8075593

Browse files
authored
Use const declarations for variables that are never reassigned (actions#322)
1 parent 21459d0 commit 8075593

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ steps:
155155
```
156156
## Getting go version from the go.mod file
157157

158-
The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be used by a project. As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will search for the latest available patch version sequentially in the runner's directory with the cached tools, in the [version-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go servers.
158+
The `go-version-file` input accepts a path to a `go.mod` file or a `go.work` file that contains the version of Go to be used by a project. As the `go.mod` file contains only major and minor (e.g. 1.18) tags, the action will search for the latest available patch version sequentially in the runner's directory with the cached tools, in the [versions-manifest.json](https://github.com/actions/go-versions/blob/main/versions-manifest.json) file or at the go servers.
159159

160160
If both the `go-version` and the `go-version-file` inputs are provided then the `go-version` input is used.
161161
> The action will search for the `go.mod` file relative to the repository root

dist/setup/index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63398,12 +63398,12 @@ function getInfoFromDist(versionSpec, arch) {
6339863398
}
6339963399
function findMatch(versionSpec, arch = os_1.default.arch()) {
6340063400
return __awaiter(this, void 0, void 0, function* () {
63401-
let archFilter = sys.getArch(arch);
63402-
let platFilter = sys.getPlatform();
63401+
const archFilter = sys.getArch(arch);
63402+
const platFilter = sys.getPlatform();
6340363403
let result;
6340463404
let match;
6340563405
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
63406-
let candidates = yield module.exports.getVersionsDist(dlUrl);
63406+
const candidates = yield module.exports.getVersionsDist(dlUrl);
6340763407
if (!candidates) {
6340863408
throw new Error(`golang download url did not return results`);
6340963409
}
@@ -63436,7 +63436,7 @@ exports.findMatch = findMatch;
6343663436
function getVersionsDist(dlUrl) {
6343763437
return __awaiter(this, void 0, void 0, function* () {
6343863438
// this returns versions descending so latest is first
63439-
let http = new httpm.HttpClient('setup-go', [], {
63439+
const http = new httpm.HttpClient('setup-go', [], {
6344063440
allowRedirects: true,
6344163441
maxRedirects: 3
6344263442
});
@@ -63484,7 +63484,7 @@ function resolveStableVersionDist(versionSpec, arch) {
6348463484
let archFilter = sys.getArch(arch);
6348563485
let platFilter = sys.getPlatform();
6348663486
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
63487-
let candidates = yield module.exports.getVersionsDist(dlUrl);
63487+
const candidates = yield module.exports.getVersionsDist(dlUrl);
6348863488
if (!candidates) {
6348963489
throw new Error(`golang download url did not return results`);
6349063490
}
@@ -63611,8 +63611,8 @@ function run() {
6361163611
const matchersPath = path_1.default.join(__dirname, '../..', 'matchers.json');
6361263612
core.info(`##[add-matcher]${matchersPath}`);
6361363613
// output the version actually being used
63614-
let goPath = yield io.which('go');
63615-
let goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
63614+
const goPath = yield io.which('go');
63615+
const goVersion = (child_process_1.default.execSync(`${goPath} version`) || '').toString();
6361663616
core.info(goVersion);
6361763617
core.setOutput('go-version', parseGoVersion(goVersion));
6361863618
core.startGroup('go env');

src/installer.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,14 +266,14 @@ export async function findMatch(
266266
versionSpec: string,
267267
arch = os.arch()
268268
): Promise<IGoVersion | undefined> {
269-
let archFilter = sys.getArch(arch);
270-
let platFilter = sys.getPlatform();
269+
const archFilter = sys.getArch(arch);
270+
const platFilter = sys.getPlatform();
271271

272272
let result: IGoVersion | undefined;
273273
let match: IGoVersion | undefined;
274274

275-
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all';
276-
let candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
275+
const dlUrl = 'https://golang.org/dl/?mode=json&include=all';
276+
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
277277
dlUrl
278278
);
279279
if (!candidates) {
@@ -315,7 +315,7 @@ export async function getVersionsDist(
315315
dlUrl: string
316316
): Promise<IGoVersion[] | null> {
317317
// this returns versions descending so latest is first
318-
let http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
318+
const http: httpm.HttpClient = new httpm.HttpClient('setup-go', [], {
319319
allowRedirects: true,
320320
maxRedirects: 3
321321
});
@@ -372,7 +372,7 @@ async function resolveStableVersionDist(versionSpec: string, arch: string) {
372372
let archFilter = sys.getArch(arch);
373373
let platFilter = sys.getPlatform();
374374
const dlUrl: string = 'https://golang.org/dl/?mode=json&include=all';
375-
let candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
375+
const candidates: IGoVersion[] | null = await module.exports.getVersionsDist(
376376
dlUrl
377377
);
378378
if (!candidates) {

src/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ export async function run() {
6767
core.info(`##[add-matcher]${matchersPath}`);
6868

6969
// output the version actually being used
70-
let goPath = await io.which('go');
71-
let goVersion = (cp.execSync(`${goPath} version`) || '').toString();
70+
const goPath = await io.which('go');
71+
const goVersion = (cp.execSync(`${goPath} version`) || '').toString();
7272
core.info(goVersion);
7373

7474
core.setOutput('go-version', parseGoVersion(goVersion));

0 commit comments

Comments
 (0)