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