refactor(lint): update golangci-lint to v2 and configure .golangci.yml (#3956)

* refactor(lint): update golangci-lint to v2 and configure .golangci.yml

Signed-off-by: yxxhero <aiopsclub@163.com>

* build: Update golangci-lint action and config

Signed-off-by: yxxhero <aiopsclub@163.com>

---------

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2025-04-15 21:14:13 +08:00 committed by GitHub
parent e2976c3a9e
commit 8d2d67255a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 50 additions and 31 deletions

View File

@ -21,10 +21,9 @@ jobs:
fetch-depth: '0'
- name: Golangci lint
uses: golangci/golangci-lint-action@051d91933864810ecd5e2ea2cfd98f6a5bca5347
uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd
with:
version: v1.62
args: --verbose --timeout=10m
version: v2.0
- name: Markdown lint
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee

View File

@ -1,37 +1,57 @@
version: "2"
run:
deadline: 3m
modules-download-mode: readonly
linters-settings:
gocyclo:
min-complexity: 100
gci:
sections:
- standard
- default
- prefix(d7y.io/api)
- prefix(d7y.io/dragonfly/v2)
linters:
default: none
enable:
- errcheck
- goconst
- gocyclo
- govet
- misspell
- staticcheck
settings:
gocyclo:
min-complexity: 100
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- staticcheck
text: 'SA1019:'
paths:
- third_party$
- builtin$
- examples$
issues:
new: true
exclude-rules:
- linters:
- staticcheck
text: "SA1019:"
linters:
disable-all: true
formatters:
enable:
- gci
- gofmt
- misspell
- govet
- goconst
- gocyclo
- staticcheck
- errcheck
settings:
gci:
sections:
- standard
- default
- prefix(d7y.io/api)
- prefix(d7y.io/dragonfly/v2)
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
output:
format: colored-line-number
print-issued-lines: true
print-linter-name: true
formats:
text:
path: stdout
print-linter-name: true
print-issued-lines: true
colors: true