chore: fix golangci-lint

This commit is contained in:
Johnny
2025-04-05 22:31:16 +08:00
parent cfc313db1d
commit 9c7b063d72
2 changed files with 88 additions and 77 deletions
+2 -2
View File
@@ -23,9 +23,9 @@ jobs:
go mod tidy go mod tidy
git diff --exit-code git diff --exit-code
- name: golangci-lint - name: golangci-lint
uses: golangci/golangci-lint-action@v6 uses: golangci/golangci-lint-action@v7
with: with:
version: v1.61.0 version: v2.0.2
args: --verbose --timeout=3m args: --verbose --timeout=3m
skip-cache: true skip-cache: true
+32 -21
View File
@@ -1,7 +1,7 @@
version: "2"
linters: linters:
enable: enable:
- errcheck
- goimports
- revive - revive
- govet - govet
- staticcheck - staticcheck
@@ -14,18 +14,18 @@ linters:
- forbidigo - forbidigo
- mirror - mirror
- bodyclose - bodyclose
disable:
issues: - errcheck
include: settings:
# https://golangci-lint.run/usage/configuration/#command-line-options exhaustive:
exclude: explicit-exhaustive-switch: false
- Rollback staticcheck:
- fmt.Printf checks:
- all
linters-settings: - -ST1000
goimports: - -ST1003
# Put imports beginning with prefix after 3rd-party packages. - -ST1021
local-prefixes: github.com/yourselfhosted/slash - -QF1003
revive: revive:
# Default to run all linters so that new rules in the future could automatically be added to the static check. # Default to run all linters so that new rules in the future could automatically be added to the static check.
enable-all-rules: true enable-all-rules: true
@@ -63,15 +63,18 @@ linters-settings:
disabled: true disabled: true
- name: use-any - name: use-any
disabled: true disabled: true
- name: var-naming - name: exported
disabled: true disabled: true
- name: unchecked-type-assertion - name: unhandled-error
disabled: true
- name: if-return
disabled: true disabled: true
- name: max-control-nesting - name: max-control-nesting
disabled: true disabled: true
- name: exported - name: redefines-builtin-id
arguments: disabled: true
- "disableStutteringCheck" - name: package-comments
disabled: true
gocritic: gocritic:
disabled-checks: disabled-checks:
- ifElseChain - ifElseChain
@@ -86,5 +89,13 @@ linters-settings:
- shadow - shadow
forbidigo: forbidigo:
forbid: forbid:
- 'fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?' - pattern: 'fmt\.Errorf(# Please use errors\.Wrap\|Wrapf\|Errorf instead)?'
- 'ioutil\.ReadDir(# Please use os\.ReadDir)?' - pattern: 'ioutil\.ReadDir(# Please use os\.ReadDir)?'
formatters:
enable:
- goimports
settings:
goimports:
local-prefixes:
- github.com/usememos/memos