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' fetch-depth: '0'
- name: Golangci lint - name: Golangci lint
uses: golangci/golangci-lint-action@051d91933864810ecd5e2ea2cfd98f6a5bca5347 uses: golangci/golangci-lint-action@1481404843c368bc19ca9406f87d6e0fc97bdcfd
with: with:
version: v1.62 version: v2.0
args: --verbose --timeout=10m
- name: Markdown lint - name: Markdown lint
uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee uses: docker://avtodev/markdown-lint:v1@sha256:6aeedc2f49138ce7a1cd0adffc1b1c0321b841dc2102408967d9301c031949ee

View File

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