mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-07-06 16:41:38 +00:00
Compare commits
118 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 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
|
||||
|
||||
@@ -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 }}
|
||||
@@ -59,8 +59,8 @@ jobs:
|
||||
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:
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
@@ -87,8 +87,8 @@ jobs:
|
||||
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:
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
@@ -110,8 +110,8 @@ jobs:
|
||||
permissions:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
cache: false # setup-go v4 caches by default
|
||||
- uses: ./
|
||||
|
||||
@@ -41,7 +41,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: '1.20'
|
||||
go-version: '1.21'
|
||||
cache: false
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v3
|
||||
@@ -49,7 +49,7 @@ jobs:
|
||||
# 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,7 +102,7 @@ jobs:
|
||||
golangci:
|
||||
strategy:
|
||||
matrix:
|
||||
go: ['1.20']
|
||||
go: ['1.21']
|
||||
os: [macos-latest, windows-latest]
|
||||
name: lint
|
||||
runs-on: ${{ matrix.os }}
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
# 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:
|
||||
|
||||
+25490
-1261
File diff suppressed because one or more lines are too long
+25490
-1261
File diff suppressed because one or more lines are too long
Generated
+955
-770
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -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.0",
|
||||
"@actions/tool-cache": "^2.0.1",
|
||||
"@types/node": "^20.5.0",
|
||||
"@types/semver": "^7.5.0",
|
||||
"@types/tmp": "^0.2.3",
|
||||
"@types/node": "^20.11.16",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"tmp": "^0.2.1"
|
||||
},
|
||||
"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",
|
||||
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
||||
"@typescript-eslint/parser": "^6.20.0",
|
||||
"@vercel/ncc": "^0.38.1",
|
||||
"eslint": "^8.56.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-plugin-import": "^2.29.1",
|
||||
"eslint-plugin-prettier": "^5.1.3",
|
||||
"eslint-plugin-simple-import-sort": "^10.0.0",
|
||||
"prettier": "^3.0.1",
|
||||
"typescript": "^5.1.6"
|
||||
"prettier": "^3.2.5",
|
||||
"typescript": "^5.3.3"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user