-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
43 lines (32 loc) · 800 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
GO ?= @go
PACKAGES ?= ./...
TEST_PACKAGES ?= ./...
COVER_PACKAGES ?= $(shell echo $(TEST_PACKAGES) | tr " " ",")
COVER_PROFILE ?= coverage.out
GOLANGCI_LINT ?= @golangci-lint
.PHONY: all
all: build test
.PNONY: fmt
fmt:
$(GO) fmt $(PACKAGES)
.PHONY: mod/tidy
mod/tidy:
$(GO) mod tidy
.PHONY: prepare
prepare: mod/tidy fmt
.PHONY: build
build: prepare
$(GO) build -v $(PACKAGES)
.PHONY: install
install: prepare
$(GO) install -v $(PACKAGES)
.PHONY: test
test: prepare
$(GO) test -v -race -coverpkg $(COVER_PACKAGES) -coverprofile $(COVER_PROFILE) $(TEST_PACKAGES)
.PHONY: coverage
coverage: test
$(GO) tool cover -func $(COVER_PROFILE) -o coverage.txt
$(GO) tool cover -html $(COVER_PROFILE) -o coverage.html
.PHONY: lint
lint: prepare
$(GOLANGCI_LINT) run -v