feat: golangci-lint v2 support (#1198)
This commit is contained in:
committed by
GitHub
parent
1f07148fa0
commit
dec74fa030
53
README.md
53
README.md
@@ -54,9 +54,9 @@ jobs:
|
||||
with:
|
||||
go-version: stable
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: v1.64
|
||||
version: v2.0
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -92,9 +92,9 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: v1.64
|
||||
version: v2.0
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
env:
|
||||
GO_VERSION: stable
|
||||
GOLANGCI_LINT_VERSION: v1.64
|
||||
GOLANGCI_LINT_VERSION: v2.0
|
||||
|
||||
jobs:
|
||||
detect-modules:
|
||||
@@ -147,7 +147,7 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
- name: golangci-lint ${{ matrix.modules }}
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: ${{ env.GOLANGCI_LINT_VERSION }}
|
||||
working-directory: ${{ matrix.modules }}
|
||||
@@ -179,7 +179,7 @@ jobs:
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
go-version: ${{ matrix.go-version }}
|
||||
golangci-lint-version: v1.64
|
||||
golangci-lint-version: v2.0
|
||||
```
|
||||
|
||||
```yaml
|
||||
@@ -201,7 +201,7 @@ on:
|
||||
golangci-lint-version:
|
||||
description: 'Golangci-lint version'
|
||||
type: string
|
||||
default: 'v1.64'
|
||||
default: 'v2.0'
|
||||
|
||||
jobs:
|
||||
detect-modules:
|
||||
@@ -229,7 +229,7 @@ jobs:
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
- name: golangci-lint ${{ matrix.modules }}
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: ${{ inputs.golangci-lint-version }}
|
||||
working-directory: ${{ matrix.modules }}
|
||||
@@ -245,6 +245,7 @@ You will also likely need to add the following `.gitattributes` file to ensure t
|
||||
|
||||
## Compatibility
|
||||
|
||||
* `v7.0.0` supports golangci-lint v2 only.
|
||||
* `v6.0.0+` removes `annotations` option, removes the default output format (`github-actions`).
|
||||
* `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`.
|
||||
* `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
|
||||
The version of golangci-lint to use.
|
||||
|
||||
When `install-mode` is:
|
||||
* `binary` (default): the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
|
||||
* `goinstall`: the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
* `binary` (default): the value can be v2.3 or v2.3.4 or `latest` to use the latest version.
|
||||
* `goinstall`: the value can be v2.3.4, `latest`, or the hash of a commit.
|
||||
* `none`: the value is ignored.
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
version: v1.58
|
||||
version: v2.0
|
||||
# ...
|
||||
```
|
||||
|
||||
@@ -290,7 +291,7 @@ The default value is `binary`.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
install-mode: "goinstall"
|
||||
# ...
|
||||
@@ -310,7 +311,7 @@ By default, it uses the `github.token` from the action.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
github-token: xxx
|
||||
# ...
|
||||
@@ -333,7 +334,7 @@ The JSONSchema used to validate the configuration depends on the version of gola
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
verify: false
|
||||
# ...
|
||||
@@ -358,7 +359,7 @@ The default value is `false`.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
only-new-issues: true
|
||||
# ...
|
||||
@@ -376,7 +377,7 @@ Working directory, useful for monorepos.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
working-directory: somedir
|
||||
# ...
|
||||
@@ -397,9 +398,9 @@ The location of the configuration file can be changed by using `--config=`
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||
args: --config=/my/path/.golangci.yml --issues-exit-code=0
|
||||
# ...
|
||||
```
|
||||
|
||||
@@ -411,7 +412,7 @@ with:
|
||||
|
||||
Force the usage of the embedded problem matchers.
|
||||
|
||||
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`).
|
||||
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`).
|
||||
|
||||
Works only with `colored-line-number` (the golangci-lint default).
|
||||
|
||||
@@ -423,7 +424,7 @@ The default value is `false`.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
problem-matchers: true
|
||||
# ...
|
||||
@@ -444,7 +445,7 @@ The default value is `false`.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
skip-cache: true
|
||||
# ...
|
||||
@@ -464,7 +465,7 @@ The default value is `false`.
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
skip-save-cache: true
|
||||
# ...
|
||||
@@ -486,7 +487,7 @@ If set the number is `<= 0`, the cache will be always invalidate (Not recommende
|
||||
<summary>Example</summary>
|
||||
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
uses: golangci/golangci-lint-action@v7
|
||||
with:
|
||||
cache-invalidation-interval: 15
|
||||
# ...
|
||||
@@ -515,7 +516,7 @@ permissions:
|
||||
pull-requests: read
|
||||
```
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
## Performance
|
||||
|
||||
|
Reference in New Issue
Block a user