Add golangci-lint config and lint tasks

- Add .golangci.yml with sensible defaults for the project
- Add lint and lint:fix tasks to Taskfile
- Remove unused findGitRoot function
- Apply gofumpt formatting fixes
This commit is contained in:
2025-12-18 05:56:11 +01:00
parent 1cca87af90
commit 4773460f3f
3 changed files with 76 additions and 14 deletions

64
.golangci.yml Normal file
View File

@ -0,0 +1,64 @@
version: "2"
linters:
default: standard
enable:
- errcheck
- govet
- staticcheck
- unused
- ineffassign
- misspell
- unconvert
- unparam
- gosec
- prealloc
- revive
- gocritic
- errname
- errorlint
- nilerr
- bodyclose
- durationcheck
- exhaustive
- copyloopvar
- perfsprint
- usestdlibvars
disable:
- depguard
- funlen
- gochecknoglobals
- gochecknoinits
- lll
- wsl
- nlreturn
- varnamelen
- exhaustruct
- ireturn
- nonamedreturns
exclusions:
generated: lax
presets:
- comments
- std-error-handling
- common-false-positives
rules:
- path: _test\.go
linters:
- errcheck
- gosec
- dupl
formatters:
enable:
- gofumpt
- goimports
issues:
max-issues-per-linter: 50
max-same-issues: 3
run:
timeout: 5m
tests: true