| 1 |
|
| 2 |
BIN=go |
| 3 |
|
| 4 |
build: |
| 5 |
${BIN} build -v ./... |
| 6 |
|
| 7 |
test: |
| 8 |
go test -race -v ./... |
| 9 |
watch-test: |
| 10 |
reflex -t 50ms -s -- sh -c 'gotest -race -v ./...' |
| 11 |
|
| 12 |
bench: |
| 13 |
go test -benchmem -count 3 -bench ./... |
| 14 |
watch-bench: |
| 15 |
reflex -t 50ms -s -- sh -c 'go test -benchmem -count 3 -bench ./...' |
| 16 |
|
| 17 |
coverage: |
| 18 |
${BIN} test -v -coverprofile=cover.out -covermode=atomic . |
| 19 |
${BIN} tool cover -html=cover.out -o cover.html |
| 20 |
|
| 21 |
# tools |
| 22 |
tools: |
| 23 |
${BIN} install github.com/cespare/reflex@latest |
| 24 |
${BIN} install github.com/rakyll/gotest@latest |
| 25 |
${BIN} install github.com/psampaz/go-mod-outdated@latest |
| 26 |
${BIN} install github.com/jondot/goweight@latest |
| 27 |
${BIN} install github.com/golangci/golangci-lint/cmd/golangci-lint@latest |
| 28 |
${BIN} get -t -u golang.org/x/tools/cmd/cover |
| 29 |
${BIN} install github.com/sonatype-nexus-community/nancy@latest |
| 30 |
go mod tidy |
| 31 |
|
| 32 |
lint: |
| 33 |
golangci-lint run --timeout 60s --max-same-issues 50 ./... |
| 34 |
lint-fix: |
| 35 |
golangci-lint run --timeout 60s --max-same-issues 50 --fix ./... |
| 36 |
|
| 37 |
audit: tools |
| 38 |
${BIN} list -json -m all | nancy sleuth |
| 39 |
|
| 40 |
outdated: tools |
| 41 |
${BIN} list -u -m -json all | go-mod-outdated -update -direct |
| 42 |
|
| 43 |
weight: tools |
| 44 |
goweight |