You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[](https://opencollective.com/golangci-lint)
`golangci-lint` is a free and open-source project built by volunteers.
20
20
21
-
If you value it, consider supporting us, we appreciate it! :heart:
21
+
If you value it, consider supporting us; we appreciate it! :heart:
22
22
23
23
## How to use
24
24
@@ -54,9 +54,9 @@ jobs:
54
54
with:
55
55
go-version: stable
56
56
- name: golangci-lint
57
-
uses: golangci/golangci-lint-action@v7
57
+
uses: golangci/golangci-lint-action@v8
58
58
with:
59
-
version: v2.0
59
+
version: v2.1
60
60
```
61
61
62
62
</details>
@@ -92,9 +92,9 @@ jobs:
92
92
with:
93
93
go-version: ${{ matrix.go }}
94
94
- name: golangci-lint
95
-
uses: golangci/golangci-lint-action@v7
95
+
uses: golangci/golangci-lint-action@v8
96
96
with:
97
-
version: v2.0
97
+
version: v2.1
98
98
```
99
99
100
100
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
@@ -120,7 +120,7 @@ on:
120
120
121
121
env:
122
122
GO_VERSION: stable
123
-
GOLANGCI_LINT_VERSION: v2.0
123
+
GOLANGCI_LINT_VERSION: v2.1
124
124
125
125
jobs:
126
126
detect-modules:
@@ -147,7 +147,7 @@ jobs:
147
147
with:
148
148
go-version: ${{ env.GO_VERSION }}
149
149
- name: golangci-lint ${{ matrix.modules }}
150
-
uses: golangci/golangci-lint-action@v7
150
+
uses: golangci/golangci-lint-action@v8
151
151
with:
152
152
version: ${{ env.GOLANGCI_LINT_VERSION }}
153
153
working-directory: ${{ matrix.modules }}
@@ -179,7 +179,7 @@ jobs:
179
179
with:
180
180
os: ${{ matrix.os }}
181
181
go-version: ${{ matrix.go-version }}
182
-
golangci-lint-version: v2.0
182
+
golangci-lint-version: v2.1
183
183
```
184
184
185
185
```yaml
@@ -201,7 +201,7 @@ on:
201
201
golangci-lint-version:
202
202
description: 'Golangci-lint version'
203
203
type: string
204
-
default: 'v2.0'
204
+
default: 'v2.1'
205
205
206
206
jobs:
207
207
detect-modules:
@@ -229,7 +229,7 @@ jobs:
229
229
with:
230
230
go-version: ${{ inputs.go-version }}
231
231
- name: golangci-lint ${{ matrix.modules }}
232
-
uses: golangci/golangci-lint-action@v7
232
+
uses: golangci/golangci-lint-action@v8
233
233
with:
234
234
version: ${{ inputs.golangci-lint-version }}
235
235
working-directory: ${{ matrix.modules }}
@@ -245,13 +245,14 @@ You will also likely need to add the following `.gitattributes` file to ensure t
245
245
246
246
## Compatibility
247
247
248
+
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
248
249
* `v7.0.0` supports golangci-lint v2 only.
249
250
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
250
251
* `v5.0.0+` removes `skip-pkg-cache` and `skip-build-cache` because the cache related to Go itself is already handled by `actions/setup-go`.
251
252
* `v4.0.0+` requires an explicit `actions/setup-go` installation step before using this action: `uses: actions/setup-go@v5`.
252
253
The `skip-go-installation` option has been removed.
253
254
* `v2.0.0+` works with `golangci-lint` version >= `v1.28.3`
254
-
* `v1.2.2` is deprecated due to we forgot to change the minimum version of `golangci-lint` to `v1.28.3` ([issue](https://github.com/golangci/golangci-lint-action/issues/39))
255
+
* `v1.2.2` is deprecated because we forgot to change the minimum version of `golangci-lint` to `v1.28.3` ([issue](https://github.com/golangci/golangci-lint-action/issues/39))
255
256
* `v1.2.1` works with `golangci-lint` version >= `v1.14.0` ([issue](https://github.com/golangci/golangci-lint-action/issues/39))
256
257
257
258
## Options
@@ -271,9 +272,9 @@ When `install-mode` is:
271
272
<summary>Example</summary>
272
273
273
274
```yml
274
-
uses: golangci/golangci-lint-action@v7
275
+
uses: golangci/golangci-lint-action@v8
275
276
with:
276
-
version: v2.0
277
+
version: v2.1
277
278
# ...
278
279
```
279
280
@@ -291,7 +292,7 @@ The default value is `binary`.
291
292
<summary>Example</summary>
292
293
293
294
```yml
294
-
uses: golangci/golangci-lint-action@v7
295
+
uses: golangci/golangci-lint-action@v8
295
296
with:
296
297
install-mode: "goinstall"
297
298
# ...
@@ -311,7 +312,7 @@ By default, it uses the `github.token` from the action.
311
312
<summary>Example</summary>
312
313
313
314
```yml
314
-
uses: golangci/golangci-lint-action@v7
315
+
uses: golangci/golangci-lint-action@v8
315
316
with:
316
317
github-token: xxx
317
318
# ...
@@ -325,16 +326,16 @@ with:
325
326
326
327
This option is `true` by default.
327
328
328
-
If the GitHub Action detects configuration file the validation will be performed unless this option is set to `false`.
329
+
If the GitHub Action detects a configuration file, the validation will be performed unless this option is set to `false`.
329
330
If there is no configuration file, the validation is skipped.
330
331
331
-
The JSONSchema used to validate the configuration depends on the version of golangci-lint you are using.
332
+
The JSON Schema used to validate the configuration depends on the version of golangci-lint you are using.
332
333
333
334
<details>
334
335
<summary>Example</summary>
335
336
336
337
```yml
337
-
uses: golangci/golangci-lint-action@v7
338
+
uses: golangci/golangci-lint-action@v8
338
339
with:
339
340
verify: false
340
341
# ...
@@ -350,16 +351,16 @@ Show only new issues.
350
351
351
352
The default value is `false`.
352
353
353
-
* `pull_request` and `pull_request_target`: the action gets the diff of the PR content from the [GitHub API](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request) and use it with `--new-from-patch`.
354
-
* `push`: the action gets the diff of the push content (difference between commits before and after the push) from the [GitHub API](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits) and use it with `--new-from-patch`.
354
+
* `pull_request` and `pull_request_target`: the action gets the diff of the PR content from the [GitHub API](https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request) and uses it with `--new-from-patch`.
355
+
* `push`: the action gets the diff of the push content (difference between commits before and after the push) from the [GitHub API](https://docs.github.com/en/rest/commits/commits?apiVersion=2022-11-28#compare-two-commits) and uses it with `--new-from-patch`.
355
356
* `merge_group`: the action gets the diff by using `--new-from-rev` option (relies on git).
356
357
You should add the option `fetch-depth: 0` to `actions/checkout` step.
357
358
358
359
<details>
359
360
<summary>Example</summary>
360
361
361
362
```yml
362
-
uses: golangci/golangci-lint-action@v7
363
+
uses: golangci/golangci-lint-action@v8
363
364
with:
364
365
only-new-issues: true
365
366
# ...
@@ -377,7 +378,7 @@ Working directory, useful for monorepos.
377
378
<summary>Example</summary>
378
379
379
380
```yml
380
-
uses: golangci/golangci-lint-action@v7
381
+
uses: golangci/golangci-lint-action@v8
381
382
with:
382
383
working-directory: somedir
383
384
# ...
@@ -391,15 +392,21 @@ with:
391
392
392
393
golangci-lint command line arguments.
393
394
394
-
Note: By default, the `.golangci.yml` file should be at the root of the repository.
395
-
The location of the configuration file can be changed by using `--config=`
395
+
> [!NOTE]
396
+
> By default, the `.golangci.yml` file should be at the root of the repository.
397
+
> The location of the configuration file can be changed by using `--config=`.
398
+
399
+
> [!IMPORTANT]
400
+
> Adding a `=` between the flag name and its value is important because the action parses the arguments on spaces.
396
401
397
402
<details>
398
403
<summary>Example</summary>
399
404
400
405
```yml
401
-
uses: golangci/golangci-lint-action@v7
406
+
uses: golangci/golangci-lint-action@v8
402
407
with:
408
+
# In some rare cases,
409
+
# you could have to use `${{ github.workspace }}` as base directory to reference your configuration file.
@@ -414,7 +421,7 @@ Force the usage of the embedded problem matchers.
414
421
415
422
By default, the [problem matcher of Go (`actions/setup-go`)](https://github.com/actions/setup-go/blob/main/matchers.json) already handles the default golangci-lint output (`text`).
416
423
417
-
Works only with `colored-line-number` (the golangci-lint default).
424
+
Works only with `text` format (the golangci-lint default).
If set to `true`, caches will not be saved, but they may still be restored, required `skip-cache: false`.
467
+
If set to `true`, caches will not be saved, but they may still be restored, requiring`skip-cache: false`.
461
468
462
469
The default value is `false`.
463
470
464
471
<details>
465
472
<summary>Example</summary>
466
473
467
474
```yml
468
-
uses: golangci/golangci-lint-action@v7
475
+
uses: golangci/golangci-lint-action@v8
469
476
with:
470
477
skip-save-cache: true
471
478
# ...
@@ -481,13 +488,13 @@ Periodically invalidate the cache every `cache-invalidation-interval` days to en
481
488
482
489
The default value is `7`.
483
490
484
-
If set the number is `<= 0`, the cache will be always invalidate (Not recommended).
491
+
If the number is `<= 0`, the cache will always be invalidated (Not recommended).
485
492
486
493
<details>
487
494
<summary>Example</summary>
488
495
489
496
```yml
490
-
uses: golangci/golangci-lint-action@v7
497
+
uses: golangci/golangci-lint-action@v8
491
498
with:
492
499
cache-invalidation-interval: 15
493
500
# ...
@@ -516,7 +523,7 @@ permissions:
516
523
pull-requests: read
517
524
```
518
525
519
-
For annotations to work use the default format output (`text`) and either use `actions/setup-go` in the job or enable the internal [problem matchers](#problem-matchers).
526
+
For annotations to work, use the default format output (`text`) and either use `actions/setup-go` in the job or enable the internal [problem matchers](#problem-matchers).
0 commit comments