chore: configure golangci-lint with multiple linters and settings

- Add a new configuration file for golangci-lint
- Set a timeout of 5 minutes for linting
- Enable multiple linters including asciicheck, errcheck, and gofmt
- Configure settings for the gosec linter with specific rule inclusions
- Add settings for the perfsprint linter to check various error handling practices

Signed-off-by: appleboy <appleboy.tw@gmail.com>
This commit is contained in:
appleboy
2025-03-08 16:30:04 +08:00
parent 91c0d241df
commit 53d0f6ec67
+42
View File
@@ -0,0 +1,42 @@
run:
timeout: 5m
linters:
enable:
- asciicheck
- durationcheck
- errcheck
- errorlint
- exportloopref
- gci
- gofmt
- goimports
- gosec
- misspell
- nakedret
- nilerr
- nolintlint
- perfsprint
- revive
- usestdlibvars
- wastedassign
linters-settings:
gosec:
# To select a subset of rules to run.
# Available rules: https://github.com/securego/gosec#available-rules
# Default: [] - means include all rules
includes:
- G102
- G106
- G108
- G109
- G111
- G112
- G201
- G203
perfsprint:
err-error: true
errorf: true
int-conversion: true
sprintf1: true
strconcat: true