chore: add Makefile

main
sudo pacman -Syu 2022-07-04 12:37:10 +07:00
parent dd84fff78d
commit 1dea716c30
No known key found for this signature in database
GPG Key ID: D6CB5C6C567C47B0
3 changed files with 97 additions and 2 deletions

10
.gitignore vendored
View File

@ -5,7 +5,13 @@
*.exe
# IntelliJ
.idea/
.idea
# VSCode
.vscode/
.vscode
# Go
coverage.out
# GoReleaser
dist

74
.golangci.yml Normal file
View File

@ -0,0 +1,74 @@
run:
tests: false
skip-dirs:
- ".*test.*"
- ".*mock.*"
- ".*generated.*"
- ".*example.*"
skip-files:
- ".*Mock.*"
- ".*_mock.*"
- ".*_generated.*"
go: "1.18"
output:
sort-results: true
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gosimple
- govet
- staticcheck
- typecheck
- unused
- varcheck
- errname
- errorlint
- execinquery
- goerr113
- gofumpt
- gosec
- ifshort
- importas
- makezero
- nilnil
- prealloc
- unconvert
fast: true
linters-settings:
gosec:
excludes:
- G402
- G501
- G505
exclude-generated: true
govet:
check-shadowing: false
disable-all: true
enable:
- assign
- atomic
- bools
- buildtag
- composites
- copylocks
- fieldalignment
- httpresponse
- loopclosure
- lostcancel
- nilfunc
- printf
- unmarshal
- unreachable
- unusedresult
staticcheck:
go: "1.18"
checks: ["all", "-SA1019"]
issues:
new: true
fix: true

15
Makefile Normal file
View File

@ -0,0 +1,15 @@
.PHONY: all test coverage-cli coverate-html lint
all: test lint
test:
go test -race -coverprofile=coverage.out ./...
coverage-cli: test
go tool cover -func=coverage.out
coverage-html: test
go tool cover -html=coverage.out
lint:
golangci-lint run ./...