#9 introduces linter

This commit is contained in:
Alex Senger 2024-04-10 16:45:57 +02:00
parent f0acb329f7
commit 5100c7ce77
No known key found for this signature in database
GPG key ID: 0B4A96F8AF6934CF
3 changed files with 45 additions and 0 deletions

4
.gitignore vendored
View file

@ -44,3 +44,7 @@ prof.mem
# Goland files
.idea/
tmp/**
# Coverage Reports
coverage_unit.out
coverage_integration.out

33
.golangci.yml Normal file
View file

@ -0,0 +1,33 @@
output:
# sorts results by: filepath, line and column
sort-results: true
linters:
enable:
- revive # general purpose linter, drop-in replacement for golint + some extra
- whitespace # checks for unnecessary newlines and trailing spaces
- unconvert # check for unnecessary type conversions
- promlinter # checks that prometheus metrics follow prometheus naming conventions, see https://prometheus.io/docs/practices/naming/
- nilerr # checks for cases where a nil value is returned even though a checked error is non-nil
- gofmt # basic gofmt + the simplification flag "-s"
- unparam # reports unused function parameters
- goimports # checks import statements are formatted according to the 'goimport' command
linters-settings:
errcheck:
ignore: Close
issues:
exclude-use-default: false
exclude-rules:
- linters:
- revive
text: package-comments
run:
build-tags:
- unit
- integration
timeout: 2m

8
Makefile Normal file
View file

@ -0,0 +1,8 @@
test.lint:
golangci-lint run --config .golangci.yml --verbose ./...
test.unit:
go test -coverprofile=coverage_unit.out -tags=unit ./...
test.integration:
go test -coverprofile=coverage_integration.out -tags=integration ./...