ci: add golangci lint config
Some checks failed
Go CI Pipeline / ci (push) Failing after 43s

This commit is contained in:
Patryk Hegenberg 2025-06-04 13:45:35 +02:00
parent d395d76d04
commit e344126665

118
.golangci.yml Normal file
View file

@ -0,0 +1,118 @@
version: "2"
linters:
enable:
# Core Go checks
- govet
- ineffassign
- unused
# Style & Complexity
# - cyclop
# - goconst
# - gocritic
# - whitespace
# Bug Prevention
- bodyclose
- contextcheck
- copyloopvar
# - errorlint
- nilerr
- rowserrcheck
- sqlclosecheck
# - unparam
# Security
# - gosec
# Test Helpers
- testifylint
- thelper
- paralleltest
disable:
# Optional: Deaktiviere zu strenge oder störende Linter
- wsl
- maintidx
- nlreturn
- errcheck
- staticcheck
# Weitere Linter nach Bedarf ausschalten
settings:
cyclop:
max-complexity: 15
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
settings:
captLocal:
paramsOnly: true
rangeValCopy:
sizeThreshold: 32
depguard:
rules:
main:
files:
- "$all"
- '!$test'
deny:
- pkg: reflect
desc: "Reflection is often unclear; consider alternatives."
- pkg: "io/ioutil"
desc: "Deprecated since Go 1.16; use 'os' or 'io' instead."
varnamelen:
min-name-length: 2
exclusions:
generated: lax
rules:
- linters:
- copyloopvar
- dupl
- errcheck
- gocyclo
- gosec
- maintidx
- unparam
path: _test(ing)?\.go
- linters:
- gocritic
path: _test\.go
text: (unnamedResult|exitAfterDefer)
- linters:
- gosec
text: 'G101:'
paths:
- zz_generated\..+\.go$
- third_party/
- internal/vendor/
issues:
max-issues-per-linter: 0
max-same-issues: 0
exclude-use-default: false
formatters:
enable:
# - gci
- gofmt
- goimports
settings:
gci:
sections:
- standard
- default
- blank
- dot
- prefix(github.com/your-org/your-repo) # Hier dein Modulname eintragen!
gofmt:
simplify: true
goimports:
local-prefixes:
- github.com/your-org/your-repo # Hier dein Modulname eintragen!
exclusions:
generated: lax
paths:
- zz_generated\..+\.go$