mirror of
https://github.com/golangci/golangci-lint-action.git
synced 2026-05-14 11:22:42 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59f43e26c9 | |||
| 9eb174e04a | |||
| 4f52504dfb | |||
| 6f87dfdbd1 | |||
| c9500d7aa7 | |||
| 03b1faa37e | |||
| 66dfb5ced2 | |||
| c592b80ac9 | |||
| 46c9287ccb | |||
| 36fe29c8f9 | |||
| 2d7e7b6785 | |||
| 40890fa829 | |||
| e94e72cadf | |||
| b269f19624 | |||
| fa2a845e31 | |||
| 2bcbc9e745 | |||
| b7bcab6379 | |||
| b207e52793 | |||
| f6671aa25d | |||
| 6b23cb2cbc | |||
| 02d66c3f78 | |||
| 17a5bf4dbc | |||
| fce8c98977 | |||
| b62bd5d234 | |||
| d6deb2e8bd | |||
| 2c963d3543 | |||
| 66754993e2 | |||
| a3a03ee425 | |||
| fd271f07e7 | |||
| de73c35617 | |||
| f75f4b02ef | |||
| f75c1c4ee8 | |||
| e9dc9291fd | |||
| 2e568c9b8b | |||
| 6ad01b21aa | |||
| ef750330e2 | |||
| 3ab2377cc3 | |||
| ca80beefdd | |||
| 87a373f691 | |||
| 7fa6da85a5 |
+1
-1
@@ -6,7 +6,7 @@
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2020,
|
||||
"sourceType": "module"
|
||||
"sourceType": "commonjs"
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
|
||||
@@ -10,8 +10,6 @@ body:
|
||||
required: true
|
||||
- label: Yes, I've searched similar issues on GitHub and didn't find any.
|
||||
required: true
|
||||
- label: Yes, I've included all information below (version, config, etc).
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: problem
|
||||
@@ -25,6 +23,7 @@ body:
|
||||
id: golangci-lint-version
|
||||
attributes:
|
||||
label: Version of golangci-lint
|
||||
placeholder: golangci-lint has version 2.x.x built with go1.x.x from xxxx on xxxx-xx-xx
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -32,6 +31,7 @@ body:
|
||||
id: github-action-version
|
||||
attributes:
|
||||
label: Version of the GitHub Action
|
||||
placeholder: v9.2.0
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -69,6 +69,7 @@ body:
|
||||
id: go-env
|
||||
attributes:
|
||||
label: Go version
|
||||
placeholder: go1.25.8
|
||||
validations:
|
||||
required: true
|
||||
|
||||
@@ -86,3 +87,19 @@ body:
|
||||
</details>
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
id: validation
|
||||
attributes:
|
||||
label: Validation
|
||||
options:
|
||||
- label: Yes, I've included all the information above (example, version, config, etc.).
|
||||
required: true
|
||||
|
||||
- type: checkboxes
|
||||
id: supporter
|
||||
attributes:
|
||||
label: Supporter
|
||||
description: If you find golangci-lint valuable, consider [sponsoring the project](https://donate.golangci.org) to help sustain its development. 💛
|
||||
options:
|
||||
- label: I am a [sponsor/backer](https://donate.golangci.org) of this project.
|
||||
|
||||
@@ -42,3 +42,11 @@ body:
|
||||
placeholder: "Add any other context or screenshots about the feature request here."
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
id: supporter
|
||||
attributes:
|
||||
label: Supporter
|
||||
description: If you find golangci-lint valuable, consider [sponsoring the project](https://donate.golangci.org) to help sustain its development. 💛
|
||||
options:
|
||||
- label: I am a [sponsor/backer](https://donate.golangci.org) of this project.
|
||||
|
||||
@@ -4,6 +4,8 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
cooldown:
|
||||
default-days: 7
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
groups:
|
||||
@@ -13,3 +15,5 @@ updates:
|
||||
dependency-type: production
|
||||
schedule:
|
||||
interval: weekly
|
||||
cooldown:
|
||||
default-days: 7
|
||||
|
||||
@@ -29,6 +29,7 @@ jobs:
|
||||
# a pull request then we can checkout the head of the pull request.
|
||||
# Only include this option if you are running this workflow on pull requests.
|
||||
fetch-depth: 2
|
||||
persist-credentials: false
|
||||
|
||||
# If this run was triggered by a pull request event then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
@@ -38,7 +39,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v4
|
||||
uses: github/codeql-action/init@v4.35.3
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
with:
|
||||
languages: 'javascript-typescript'
|
||||
@@ -48,4 +49,4 @@ jobs:
|
||||
npm run all
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v4
|
||||
uses: github/codeql-action/analyze@v4.35.3
|
||||
|
||||
@@ -20,6 +20,8 @@ jobs:
|
||||
with:
|
||||
node-version: 24.x
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- run: |
|
||||
npm install
|
||||
npm run all
|
||||
@@ -40,14 +42,16 @@ jobs:
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.5"
|
||||
- "v2.5.0"
|
||||
- "v2.10"
|
||||
- "v2.10.1"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24.x
|
||||
@@ -73,14 +77,16 @@ jobs:
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.5.0"
|
||||
- "655e8ede5178280b2a640e185bc4a343aed0f54e"
|
||||
- "v2.10.1"
|
||||
- "f8861ca84d805a673945d037bae1559c3567aadc"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24.x
|
||||
@@ -111,6 +117,8 @@ jobs:
|
||||
contents: read
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24.x
|
||||
@@ -135,14 +143,16 @@ jobs:
|
||||
version:
|
||||
- ""
|
||||
- "latest"
|
||||
- "v2.5"
|
||||
- "v2.5.0"
|
||||
- "v2.10"
|
||||
- "v2.10.1"
|
||||
runs-on: ${{ matrix.os }}
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24.x
|
||||
@@ -170,6 +180,8 @@ jobs:
|
||||
pull-requests: read
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
persist-credentials: false
|
||||
- uses: actions/setup-node@v6
|
||||
with:
|
||||
node-version: 24.x
|
||||
|
||||
@@ -49,14 +49,14 @@ jobs:
|
||||
name: lint
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: stable
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.6
|
||||
version: v2.12
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -87,14 +87,14 @@ jobs:
|
||||
name: lint
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
- name: golangci-lint
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.6
|
||||
version: v2.12
|
||||
```
|
||||
|
||||
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: v2.6
|
||||
GOLANGCI_LINT_VERSION: v2.12
|
||||
|
||||
jobs:
|
||||
detect-modules:
|
||||
@@ -128,7 +128,7 @@ jobs:
|
||||
outputs:
|
||||
modules: ${{ steps.set-modules.outputs.modules }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
@@ -142,7 +142,7 @@ jobs:
|
||||
matrix:
|
||||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ env.GO_VERSION }}
|
||||
@@ -179,7 +179,7 @@ jobs:
|
||||
with:
|
||||
os: ${{ matrix.os }}
|
||||
go-version: ${{ matrix.go-version }}
|
||||
golangci-lint-version: v2.6
|
||||
golangci-lint-version: v2.12
|
||||
```
|
||||
|
||||
```yaml
|
||||
@@ -201,7 +201,7 @@ on:
|
||||
golangci-lint-version:
|
||||
description: 'Golangci-lint version'
|
||||
type: string
|
||||
default: 'v2.6'
|
||||
default: 'v2.12'
|
||||
|
||||
jobs:
|
||||
detect-modules:
|
||||
@@ -209,7 +209,7 @@ jobs:
|
||||
outputs:
|
||||
modules: ${{ steps.set-modules.outputs.modules }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
@@ -224,7 +224,7 @@ jobs:
|
||||
matrix:
|
||||
modules: ${{ fromJSON(needs.detect-modules.outputs.modules) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: ${{ inputs.go-version }}
|
||||
@@ -247,7 +247,6 @@ You will also likely need to add the following `.gitattributes` file to ensure t
|
||||
|
||||
* `v9.0.0` requires Nodejs runtime [`node24`](https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/)
|
||||
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
||||
* `v8.0.0` works with `golangci-lint` version >= `v2.1.0`
|
||||
* `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`.
|
||||
@@ -297,7 +296,7 @@ When `install-mode` is:
|
||||
```yml
|
||||
uses: golangci/golangci-lint-action@v9
|
||||
with:
|
||||
version: v2.6
|
||||
version: v2.12
|
||||
# ...
|
||||
```
|
||||
|
||||
@@ -333,7 +332,7 @@ The mode to install golangci-lint: it can be `binary`, `goinstall`, or `none`.
|
||||
|
||||
The default value is `binary`.
|
||||
|
||||
`goinstall` is not recommended, more explanations [here](https://golangci-lint.run/docs/welcome/install/#install-from-sources).
|
||||
`goinstall` is not recommended, more explanations [here](https://golangci-lint.run/docs/welcome/install/local/#install-from-sources).
|
||||
|
||||
<details>
|
||||
<summary>Example</summary>
|
||||
@@ -647,6 +646,22 @@ build and run the custom version of golangci-lint.
|
||||
|
||||
For more information, see [module plugin system](https://golangci-lint.run/docs/plugins/module-plugins/).
|
||||
|
||||
## Tips
|
||||
|
||||
### Using Renovate to update the golangci-lint version
|
||||
|
||||
[Renovate](https://docs.renovatebot.com/) can update both the action and the
|
||||
`golangci-lint` version it uses via its [github-actions manager](https://docs.renovatebot.com/modules/manager/github-actions/#commonly-used-community-actions)
|
||||
which is included in presets like `config:recommended`.
|
||||
|
||||
It can also be enabled explicitly in `renovate.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"enabledManagers": ["github-actions"]
|
||||
}
|
||||
```
|
||||
|
||||
## Performance
|
||||
|
||||
The action was implemented with performance in mind:
|
||||
|
||||
+61755
-63263
File diff suppressed because one or more lines are too long
+61755
-63263
File diff suppressed because one or more lines are too long
@@ -0,0 +1,55 @@
|
||||
import { defineConfig } from "eslint/config";
|
||||
import { fixupConfigRules, fixupPluginRules } from "@eslint/compat";
|
||||
import typescriptEslint from "@typescript-eslint/eslint-plugin";
|
||||
import simpleImportSort from "eslint-plugin-simple-import-sort";
|
||||
import globals from "globals";
|
||||
import tsParser from "@typescript-eslint/parser";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import js from "@eslint/js";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all
|
||||
});
|
||||
|
||||
export default defineConfig([{
|
||||
extends: fixupConfigRules(compat.extends(
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/eslint-recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:import/typescript",
|
||||
"plugin:prettier/recommended",
|
||||
)),
|
||||
|
||||
plugins: {
|
||||
"@typescript-eslint": fixupPluginRules(typescriptEslint),
|
||||
"simple-import-sort": simpleImportSort,
|
||||
},
|
||||
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.jest,
|
||||
},
|
||||
|
||||
parser: tsParser,
|
||||
ecmaVersion: 2020,
|
||||
sourceType: "commonjs",
|
||||
},
|
||||
|
||||
rules: {
|
||||
"import/first": "error",
|
||||
"import/newline-after-import": "error",
|
||||
"import/no-duplicates": "error",
|
||||
"simple-import-sort/imports": "error",
|
||||
"simple-import-sort/exports": "error",
|
||||
"sort-imports": "off",
|
||||
},
|
||||
}]);
|
||||
@@ -1,4 +1,4 @@
|
||||
version: v2.6.1
|
||||
version: v2.10.1
|
||||
name: custom-golangci-lint
|
||||
#destination: ./zzz/path/
|
||||
|
||||
|
||||
Generated
+952
-932
File diff suppressed because it is too large
Load Diff
+19
-12
@@ -27,31 +27,38 @@
|
||||
"node": ">=24.0.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/cache": "^4.1.0",
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/exec": "^1.1.1",
|
||||
"@actions/github": "^6.0.1",
|
||||
"@actions/cache": "^5.0.3",
|
||||
"@actions/core": "^2.0.2",
|
||||
"@actions/exec": "^2.0.0",
|
||||
"@actions/github": "^7.0.0",
|
||||
"@actions/http-client": "^3.0.0",
|
||||
"@actions/tool-cache": "^3.0.0",
|
||||
"@octokit/plugin-retry": "^6.1.0",
|
||||
"@actions/tool-cache": "^2.0.2",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/node": "^25.0.10",
|
||||
"@types/semver": "^7.7.1",
|
||||
"@types/tmp": "^0.2.6",
|
||||
"@types/which": "^3.0.4",
|
||||
"tmp": "^0.2.5",
|
||||
"which": "^6.0.0",
|
||||
"yaml": "^2.8.2"
|
||||
"which": "^6.0.1",
|
||||
"yaml": "^2.8.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^8.48.0",
|
||||
"@eslint/compat": "^2.0.5",
|
||||
"@eslint/eslintrc": "^3.3.5",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@typescript-eslint/eslint-plugin": "^8.58.1",
|
||||
"@typescript-eslint/parser": "^8.32.1",
|
||||
"@vercel/ncc": "^0.38.4",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-prettier": "^5.5.4",
|
||||
"eslint-plugin-prettier": "^5.5.5",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"prettier": "^3.7.3",
|
||||
"globals": "^17.5.0",
|
||||
"prettier": "^3.8.2",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"overrides": {
|
||||
"undici": "^6.24.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user