Debian Codegraph @

Makefile

raw
1 SHELL := /bin/bash -eu -o pipefail
2
3 GO_TEST_FLAGS := -v
4
5 PACKAGE_DIRS := $(shell go list ./... 2> /dev/null | grep -v /vendor/)
6 SRC_FILES := $(shell find . -name '*.go' -not -path './vendor/*')
7
8
9 # Tasks
10 #-----------------------------------------------
11 .PHONY: lint
12 lint:
13 @gofmt -e -d -s $(SRC_FILES) | awk '{ e = 1; print $0 } END { if (e) exit(1) }'
14 @golangci-lint --disable errcheck,unused run
15
16 .PHONY: test
17 test: lint
18 @go test $(GO_TEST_FLAGS) $(PACKAGE_DIRS)
19
20 .PHONY: ci-test
21 ci-test: lint
22 @echo > coverage.txt
23 @for d in $(PACKAGE_DIRS); do \
24 go test -coverprofile=profile.out -covermode=atomic -race -v $$d; \
25 if [ -f profile.out ]; then \
26 cat profile.out >> coverage.txt; \
27 rm profile.out; \
28 fi; \
29 done