Skip to content

Commit dec74fa

Browse files
authored
feat: golangci-lint v2 support (golangci#1198)
1 parent 1f07148 commit dec74fa

File tree

15 files changed

+106
-165
lines changed

15 files changed

+106
-165
lines changed

.github/workflows/test.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ jobs:
5454
version:
5555
- ""
5656
- "latest"
57-
- "v1.63" # TODO(ldez): it should be updated for v2.
58-
- "v1.63.4" # TODO(ldez): it should be updated for v2.
57+
- "v2.0"
58+
- "v2.0.0"
5959
runs-on: ${{ matrix.os }}
6060
permissions:
6161
contents: read
@@ -83,8 +83,8 @@ jobs:
8383
version:
8484
- ""
8585
- "latest"
86-
- "v1.63.4" # TODO(ldez): it should be updated for v2.
87-
- "95c39ac1fbaf66475705c06c16259ffd9d6bf9a2" # TODO(ldez): it should be updated for v2.
86+
- "v2.0.0"
87+
- "1f032fbc4b117e4247b19ff606cc847ab5383bc9"
8888
runs-on: ${{ matrix.os }}
8989
permissions:
9090
contents: read

.golangci.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
version: "2"
2+
13
output:
24
show-stats: true
3-
sort-results: true
45
sort-order:
6+
- file
57
- linter
6-
- file

README.md

+27-26
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ jobs:
5454
with:
5555
go-version: stable
5656
- name: golangci-lint
57-
uses: golangci/golangci-lint-action@v6
57+
uses: golangci/golangci-lint-action@v7
5858
with:
59-
version: v1.64
59+
version: v2.0
6060
```
6161
6262
</details>
@@ -92,9 +92,9 @@ jobs:
9292
with:
9393
go-version: ${{ matrix.go }}
9494
- name: golangci-lint
95-
uses: golangci/golangci-lint-action@v6
95+
uses: golangci/golangci-lint-action@v7
9696
with:
97-
version: v1.64
97+
version: v2.0
9898
```
9999
100100
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:
120120
121121
env:
122122
GO_VERSION: stable
123-
GOLANGCI_LINT_VERSION: v1.64
123+
GOLANGCI_LINT_VERSION: v2.0
124124
125125
jobs:
126126
detect-modules:
@@ -147,7 +147,7 @@ jobs:
147147
with:
148148
go-version: ${{ env.GO_VERSION }}
149149
- name: golangci-lint ${{ matrix.modules }}
150-
uses: golangci/golangci-lint-action@v6
150+
uses: golangci/golangci-lint-action@v7
151151
with:
152152
version: ${{ env.GOLANGCI_LINT_VERSION }}
153153
working-directory: ${{ matrix.modules }}
@@ -179,7 +179,7 @@ jobs:
179179
with:
180180
os: ${{ matrix.os }}
181181
go-version: ${{ matrix.go-version }}
182-
golangci-lint-version: v1.64
182+
golangci-lint-version: v2.0
183183
```
184184

185185
```yaml
@@ -201,7 +201,7 @@ on:
201201
golangci-lint-version:
202202
description: 'Golangci-lint version'
203203
type: string
204-
default: 'v1.64'
204+
default: 'v2.0'
205205
206206
jobs:
207207
detect-modules:
@@ -229,7 +229,7 @@ jobs:
229229
with:
230230
go-version: ${{ inputs.go-version }}
231231
- name: golangci-lint ${{ matrix.modules }}
232-
uses: golangci/golangci-lint-action@v6
232+
uses: golangci/golangci-lint-action@v7
233233
with:
234234
version: ${{ inputs.golangci-lint-version }}
235235
working-directory: ${{ matrix.modules }}
@@ -245,6 +245,7 @@ You will also likely need to add the following `.gitattributes` file to ensure t
245245

246246
## Compatibility
247247

248+
* `v7.0.0` supports golangci-lint v2 only.
248249
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
249250
* `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`.
250251
* `v4.0.0+` requires an explicit `actions/setup-go` installation step before using this action: `uses: actions/setup-go@v5`.
@@ -262,17 +263,17 @@ You will also likely need to add the following `.gitattributes` file to ensure t
262263
The version of golangci-lint to use.
263264

264265
When `install-mode` is:
265-
* `binary` (default): the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
266-
* `goinstall`: the value can be v1.2.3, `latest`, or the hash of a commit.
266+
* `binary` (default): the value can be v2.3 or v2.3.4 or `latest` to use the latest version.
267+
* `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
267268
* `none`: the value is ignored.
268269

269270
<details>
270271
<summary>Example</summary>
271272

272273
```yml
273-
uses: golangci/golangci-lint-action@v6
274+
uses: golangci/golangci-lint-action@v7
274275
with:
275-
version: v1.58
276+
version: v2.0
276277
# ...
277278
```
278279

@@ -290,7 +291,7 @@ The default value is `binary`.
290291
<summary>Example</summary>
291292

292293
```yml
293-
uses: golangci/golangci-lint-action@v6
294+
uses: golangci/golangci-lint-action@v7
294295
with:
295296
install-mode: "goinstall"
296297
# ...
@@ -310,7 +311,7 @@ By default, it uses the `github.token` from the action.
310311
<summary>Example</summary>
311312

312313
```yml
313-
uses: golangci/golangci-lint-action@v6
314+
uses: golangci/golangci-lint-action@v7
314315
with:
315316
github-token: xxx
316317
# ...
@@ -333,7 +334,7 @@ The JSONSchema used to validate the configuration depends on the version of gola
333334
<summary>Example</summary>
334335

335336
```yml
336-
uses: golangci/golangci-lint-action@v6
337+
uses: golangci/golangci-lint-action@v7
337338
with:
338339
verify: false
339340
# ...
@@ -358,7 +359,7 @@ The default value is `false`.
358359
<summary>Example</summary>
359360

360361
```yml
361-
uses: golangci/golangci-lint-action@v6
362+
uses: golangci/golangci-lint-action@v7
362363
with:
363364
only-new-issues: true
364365
# ...
@@ -376,7 +377,7 @@ Working directory, useful for monorepos.
376377
<summary>Example</summary>
377378

378379
```yml
379-
uses: golangci/golangci-lint-action@v6
380+
uses: golangci/golangci-lint-action@v7
380381
with:
381382
working-directory: somedir
382383
# ...
@@ -397,9 +398,9 @@ The location of the configuration file can be changed by using `--config=`
397398
<summary>Example</summary>
398399

399400
```yml
400-
uses: golangci/golangci-lint-action@v6
401+
uses: golangci/golangci-lint-action@v7
401402
with:
402-
args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
403+
args: --config=/my/path/.golangci.yml --issues-exit-code=0
403404
# ...
404405
```
405406

@@ -411,7 +412,7 @@ with:
411412

412413
Force the usage of the embedded problem matchers.
413414

414-
By default, the [problem matcher of Go (`actions/setup-go`)](https://github.com/actions/setup-go/blob/main/matchers.json) already handles the golangci-lint output (`colored-line-number`).
415+
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`).
415416

416417
Works only with `colored-line-number` (the golangci-lint default).
417418

@@ -423,7 +424,7 @@ The default value is `false`.
423424
<summary>Example</summary>
424425

425426
```yml
426-
uses: golangci/golangci-lint-action@v6
427+
uses: golangci/golangci-lint-action@v7
427428
with:
428429
problem-matchers: true
429430
# ...
@@ -444,7 +445,7 @@ The default value is `false`.
444445
<summary>Example</summary>
445446

446447
```yml
447-
uses: golangci/golangci-lint-action@v6
448+
uses: golangci/golangci-lint-action@v7
448449
with:
449450
skip-cache: true
450451
# ...
@@ -464,7 +465,7 @@ The default value is `false`.
464465
<summary>Example</summary>
465466

466467
```yml
467-
uses: golangci/golangci-lint-action@v6
468+
uses: golangci/golangci-lint-action@v7
468469
with:
469470
skip-save-cache: true
470471
# ...
@@ -486,7 +487,7 @@ If set the number is `<= 0`, the cache will be always invalidate (Not recommende
486487
<summary>Example</summary>
487488

488489
```yml
489-
uses: golangci/golangci-lint-action@v6
490+
uses: golangci/golangci-lint-action@v7
490491
with:
491492
cache-invalidation-interval: 15
492493
# ...
@@ -515,7 +516,7 @@ permissions:
515516
pull-requests: read
516517
```
517518
518-
For annotations to work use the default `colored-line-number` output and either use `actions/setup-go` in the job or enable the internal [problem matchers](#problem-matchers).
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).
519520

520521
## Performance
521522

action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ inputs:
77
description: |
88
The version of golangci-lint to use.
99
When `install-mode` is:
10-
- `binary` (default): the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
11-
- `goinstall`: the value can be v1.2.3, `latest`, or the hash of a commit.
10+
- `binary` (default): the value can be v2.3 or v2.3.4 or `latest` to use the latest version.
11+
- `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
1212
- `none`: the value is ignored.
1313
required: false
1414
install-mode:

dist/post_run/index.js

+19-39
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)