mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-05-14 11:22:42 +00:00
Compare commits
162 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d6238b002a | |||
| 847b9efe2e | |||
| 019c5ec617 | |||
| 3dea681709 | |||
| 155e5ebdeb | |||
| 14117827cf | |||
| e3c1789d3f | |||
| 24de455de2 | |||
| 0068957dcf | |||
| 8cca243457 | |||
| c1ec8d27ed | |||
| 80ffcf7ac5 | |||
| c9cf8614bf | |||
| ca92b655d7 | |||
| e637d2bbe4 | |||
| f7e6ffb14d | |||
| 04092870fd | |||
| 15ace4fc54 | |||
| 66db41e5dd | |||
| a54aa6ce0b | |||
| 0cb4e4ce8a | |||
| c2b1114313 | |||
| 1ef822c9e7 | |||
| 0cf702c571 | |||
| e0e0b2b842 | |||
| d7b3f577a7 | |||
| a3062e4021 | |||
| 0cea014686 | |||
| c9cca96908 | |||
| 2e99f461f3 | |||
| 27463c1456 | |||
| 47f5f04922 | |||
| 6d0160cbf8 | |||
| 52b846a8b5 | |||
| 3f7fc68782 | |||
| 1eba11c6d8 | |||
| 552a57d5dc | |||
| a83e3d11f6 | |||
| 2fc4c770fc | |||
| 0ea26a0a52 | |||
| f1a742892f | |||
| 2031bb15ab | |||
| 17bf0db4b7 | |||
| de85e3b9b1 | |||
| 3cfe3a4abb | |||
| cbc59cf0d1 | |||
| 459a04b021 | |||
| e2315b67db | |||
| d6173a45d0 | |||
| 0e8f5bf773 | |||
| 349d20632d | |||
| 2221aee284 | |||
| 3b44ae5b24 | |||
| 323b871bbc | |||
| a23373f4c8 | |||
| e38f944096 | |||
| 3c5e1cac39 | |||
| 0f1139540c | |||
| 81218f8e0c | |||
| cc439c2555 | |||
| 3efd423e8d | |||
| effc519e1b | |||
| cfaf0f0750 | |||
| 86abc3c6d2 | |||
| c5ba143a4c | |||
| a9d24cbbd7 | |||
| 2e6adf08a9 | |||
| 1c2ceb7f27 | |||
| 5f85afe386 | |||
| 05d79cc0e4 | |||
| edcd1211b8 | |||
| eb69bf92e7 | |||
| 92ed864d2e | |||
| 3eeea96a33 | |||
| c701339303 | |||
| e03e943597 | |||
| 50372b6518 | |||
| b6b6b379de | |||
| 7d8fef21df | |||
| 0d0b9c12e8 | |||
| 7989493c23 | |||
| f7e7174579 | |||
| 46a279bd0a | |||
| 4f796ce6b5 | |||
| dd7bdbe4bf | |||
| 5e13907514 | |||
| c0b0a00641 | |||
| 88688a2400 | |||
| a50083874e | |||
| 8e84a3001a | |||
| 9a8fa77b90 | |||
| 677d5e3b79 | |||
| abd6e0ea0b | |||
| 7778b2da3c | |||
| bfee5ee11d | |||
| 608f9e14ec | |||
| 9381bb2c2c | |||
| 17e44d79cb | |||
| 25ef9ca970 | |||
| 170a3a0cf1 | |||
| a76f44e7d8 | |||
| 8fa7dff7b9 | |||
| face0856de | |||
| ec66a939a9 | |||
| c44dc93f23 | |||
| d2a0133e31 | |||
| 455de4e66d | |||
| 61c1a4a9f5 | |||
| 604fe72b13 | |||
| 3c85045f6e | |||
| d9fc28500d | |||
| 7d357a3513 | |||
| b45661bc10 | |||
| 31c68b6041 | |||
| d27d0c27ac | |||
| 4b1e98b37d | |||
| 5a72764667 | |||
| 30416f05a0 | |||
| a555e8cdd0 | |||
| c8710f274e | |||
| 40776d7557 | |||
| 9cb5ef734c | |||
| 62f96762dd | |||
| 84072ff78e | |||
| a625c15a6b | |||
| 5545aac6a3 | |||
| e09eda33b5 | |||
| 526ce234e5 | |||
| 507ec96a74 | |||
| 252bd8e8ba | |||
| 07341d3490 | |||
| 9df6f480ac | |||
| 6f4d254d44 | |||
| a24255b274 | |||
| c12092e88f | |||
| 031ba7f7a9 | |||
| c8d4ef2f53 | |||
| 31c1b1aa98 | |||
| 31eb4eaded | |||
| 5f5f252fe2 | |||
| c624d54a53 | |||
| d735dc073f | |||
| 846e7ddcd9 | |||
| d66278f1e9 | |||
| 1afd74ce23 | |||
| c67416616c | |||
| 29052a94fb | |||
| 2d06cf1746 | |||
| 953db97e74 | |||
| f7b4bdd2ad | |||
| 239c8dab36 | |||
| 237bd9f909 | |||
| fef6a0f2be | |||
| 2d891f879c | |||
| 1e9c424622 | |||
| cf670955c6 | |||
| c49c2afa5d | |||
| 81871bcfd1 | |||
| b2f426ba19 | |||
| f8a3dc114e | |||
| 1330ad3e73 | |||
| 6efbbade29 |
@@ -16,7 +16,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
# Must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head of the pull request.
|
||||
@@ -31,7 +31,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
uses: github/codeql-action/init@v3
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
language: 'javascript'
|
||||
@@ -41,4 +41,4 @@ jobs:
|
||||
npm run all
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
uses: github/codeql-action/analyze@v3
|
||||
|
||||
+15
-12
@@ -11,9 +11,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- if: ${{ !(github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))) }}
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- if: github.event_name == 'pull_request' && (github.event.pull_request.user.id == 49699333 || contains(github.event.pull_request.labels.*.name, 'dependencies'))
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
@@ -52,16 +52,17 @@ jobs:
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v1.53"
|
||||
- "v1.53.2"
|
||||
- "v1.56"
|
||||
- "v1.56.1"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: oldstable
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
with:
|
||||
@@ -80,16 +81,17 @@ jobs:
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v1.53.2"
|
||||
- "b5093688c0d3008eaacd6066773a1a52e689252f"
|
||||
- "v1.56.1"
|
||||
- "bf5008a11acf2da5fe76716eb21d808499e079fa"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: oldstable
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
with:
|
||||
@@ -110,9 +112,10 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: oldstable
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
with:
|
||||
|
||||
@@ -9,7 +9,7 @@ The action runs [golangci-lint](https://github.com/golangci/golangci-lint) and r
|
||||
|
||||
## Compatibility
|
||||
|
||||
* `v3.0.0+` requires explicit setup-go installation step prior to using this action: `uses: actions/setup-go@v3`.
|
||||
* `v4.0.0+` requires an explicit setup-go installation step before using this action: `uses: actions/setup-go@v5`.
|
||||
The `skip-go-installation` option has been removed.
|
||||
* `v2.0.0+` works with `golangci-lint` version >= `v1.28.3`
|
||||
* `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))
|
||||
@@ -38,18 +38,18 @@ jobs:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.20'
|
||||
go-version: '1.21'
|
||||
cache: false
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
with:
|
||||
# Require: 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.
|
||||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
version: v1.53
|
||||
version: v1.54
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
@@ -82,7 +82,7 @@ because different jobs [run in parallel](https://help.github.com/en/actions/gett
|
||||
|
||||
### Multiple OS Support
|
||||
|
||||
If you need to run linters for specific operating systems, you will need to use `v2` of the action. Here is a sample configuration file:
|
||||
If you need to run linters for specific operating systems, you will need to use the action `>=v2`. Here is a sample configuration file:
|
||||
|
||||
```yaml
|
||||
name: golangci-lint
|
||||
@@ -102,23 +102,23 @@ jobs:
|
||||
golangci:
|
||||
strategy:
|
||||
matrix:
|
||||
go: ['1.20']
|
||||
go: ['1.21']
|
||||
os: [macos-latest, windows-latest]
|
||||
name: lint
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
cache: false
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
with:
|
||||
# Require: 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.
|
||||
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
|
||||
version: v1.53
|
||||
version: v1.54
|
||||
|
||||
# Optional: working directory, useful for monorepos
|
||||
# working-directory: somedir
|
||||
@@ -136,7 +136,7 @@ jobs:
|
||||
# install-mode: "goinstall"
|
||||
```
|
||||
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for windows builds are properly formatted:
|
||||
You will also likely need to add the following `.gitattributes` file to ensure that line endings for Windows builds are properly formatted:
|
||||
|
||||
```.gitattributes
|
||||
*.go text eol=lf
|
||||
@@ -144,12 +144,24 @@ You will also likely need to add the following `.gitattributes` file to ensure t
|
||||
|
||||
## Comments and Annotations
|
||||
|
||||
Currently, GitHub parses the action's output and creates [annotations](https://github.community/t5/GitHub-Actions/What-are-annotations/td-p/30770).
|
||||
Currently, GitHub parses the action's output and creates [annotations](https://github.blog/2018-12-14-introducing-check-runs-and-annotations/).
|
||||
|
||||
The restrictions of annotations are the following:
|
||||
|
||||
1. Currently, they don't support markdown formatting (see the [feature request](https://github.community/t5/GitHub-API-Development-and/Checks-Ability-to-include-Markdown-in-line-annotations/m-p/56704))
|
||||
2. They aren't shown in list of comments like it was with [golangci.com](https://golangci.com). If you would like to have comments - please, up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
|
||||
2. They aren't shown in the list of comments like it was with [golangci.com](https://golangci.com). If you would like to have comments - please, up-vote [the issue](https://github.com/golangci/golangci-lint-action/issues/5).
|
||||
|
||||
To enable annotations, you need to add the `checks' permission to your action.
|
||||
|
||||
```yaml annotate
|
||||
permissions:
|
||||
# Required: allow read access to the content for analysis.
|
||||
contents: read
|
||||
# Optional: allow read access to pull request. Use with `only-new-issues` option.
|
||||
pull-requests: read
|
||||
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
|
||||
checks: write
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
@@ -157,7 +169,7 @@ The action was implemented with performance in mind:
|
||||
|
||||
1. We cache data by [@actions/cache](https://github.com/actions/toolkit/tree/master/packages/cache) between builds: Go build cache, Go modules cache, golangci-lint analysis cache.
|
||||
2. We don't use Docker because image pulling is slow.
|
||||
3. We do as much as we can in parallel, e.g. we download cache, go and golangci-lint binary in parallel.
|
||||
3. We do as much as we can in parallel, e.g. we download cache, go, and golangci-lint binary in parallel.
|
||||
|
||||
For example, in a repository of [golangci-lint](https://github.com/golangci/golangci-lint) running this action without the cache takes 50s, but with cache takes 14s:
|
||||
* in parallel:
|
||||
@@ -172,12 +184,12 @@ We use JavaScript-based action. We don't use Docker-based action because:
|
||||
1. docker pulling is slow currently
|
||||
2. it's easier to use caching from [@actions/cache](https://github.com/actions/toolkit/tree/master/packages/cache)
|
||||
|
||||
We support different platforms, such as `ubuntu`, `macos` and `windows` with `x32` and `x64` archs.
|
||||
We support different platforms, such as `ubuntu`, `macos`, and `windows` with `x32` and `x64` archs.
|
||||
|
||||
Inside our action we perform 3 steps:
|
||||
Inside our action, we perform 3 steps:
|
||||
|
||||
1. Setup environment running in parallel:
|
||||
* restore [cache](https://github.com/actions/cache) of previous analyzes
|
||||
* restore [cache](https://github.com/actions/cache) of previous analyses
|
||||
* fetch [action config](https://github.com/golangci/golangci-lint/blob/master/assets/github-action-config.json) and find the latest `golangci-lint` patch version
|
||||
for needed version (users of this action can specify only minor version of `golangci-lint`). After that install [golangci-lint](https://github.com/golangci/golangci-lint) using [@actions/tool-cache](https://github.com/actions/toolkit/tree/master/packages/tool-cache)
|
||||
2. Run `golangci-lint` with specified by user `args`
|
||||
|
||||
+1
-1
@@ -42,7 +42,7 @@ inputs:
|
||||
default: "binary"
|
||||
required: false
|
||||
runs:
|
||||
using: "node16"
|
||||
using: "node20"
|
||||
main: "dist/run/index.js"
|
||||
post: "dist/post_run/index.js"
|
||||
branding:
|
||||
|
||||
+26267
-3707
File diff suppressed because one or more lines are too long
+26267
-3707
File diff suppressed because one or more lines are too long
Generated
+1062
-871
File diff suppressed because it is too large
Load Diff
+18
-18
@@ -24,27 +24,27 @@
|
||||
"author": "golangci",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@actions/cache": "^3.2.2",
|
||||
"@actions/core": "^1.10.0",
|
||||
"@actions/cache": "^3.2.4",
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^5.1.1",
|
||||
"@actions/http-client": "^2.1.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@actions/http-client": "^2.2.1",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@types/node": "^20.5.0",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@types/tmp": "^0.2.3",
|
||||
"tmp": "^0.2.1"
|
||||
"@types/node": "^20.12.7",
|
||||
"@types/semver": "^7.5.8",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"tmp": "^0.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^6.3.0",
|
||||
"@typescript-eslint/parser": "^6.3.0",
|
||||
"@vercel/ncc": "^0.36.1",
|
||||
"eslint": "^8.47.0",
|
||||
"eslint-config-prettier": "^9.0.0",
|
||||
"eslint-plugin-import": "^2.28.0",
|
||||
"eslint-plugin-prettier": "^5.0.0",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"prettier": "^3.0.1",
|
||||
"typescript": "^5.1.6"
|
||||
"@typescript-eslint/eslint-plugin": "^7.7.0",
|
||||
"@typescript-eslint/parser": "^7.7.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.0",
|
||||
"prettier": "^3.2.5",
|
||||
"typescript": "^5.4.5"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ require (
|
||||
golang.org/x/sys v0.5.0 // indirect
|
||||
golang.org/x/text v0.6.0 // indirect
|
||||
golang.org/x/tools v0.6.0 // indirect
|
||||
google.golang.org/protobuf v1.28.0 // indirect
|
||||
google.golang.org/protobuf v1.33.0 // indirect
|
||||
gopkg.in/ini.v1 v1.67.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
|
||||
@@ -924,8 +924,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
|
||||
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
|
||||
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
||||
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
||||
Reference in New Issue
Block a user