-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
46 lines (35 loc) · 836 Bytes
/
Copy pathMakefile
File metadata and controls
46 lines (35 loc) · 836 Bytes
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
44
45
46
GO ?= go
GOLANGCI_LINT ?= golangci-lint
PACKAGES ?= ./...
TEST_PACKAGES ?= $(PACKAGES)
COVER_PROFILE ?= coverage.out
COVER_REPORT ?= coverage.html
.SILENT:
.PHONY: build
build:
$(GO) build -v $(PACKAGES)
.PHONY: test
test: COVER_PACKAGES ?= $(shell echo $(TEST_PACKAGES) | tr " " ",")
test:
$(GO) test -v -race -coverpkg $(COVER_PACKAGES) -coverprofile $(COVER_PROFILE) $(TEST_PACKAGES)
.PHONY: coverage
coverage: test
$(GO) tool cover -func $(COVER_PROFILE)
$(GO) tool cover -html $(COVER_PROFILE) -o $(COVER_REPORT)
.PHONY: lint
lint:
$(GOLANGCI_LINT) run -v
.PHONY: fmt
fmt:
$(GO) fmt $(PACKAGES)
.PHONY: mod/tidy
mod/tidy:
$(GO) mod tidy
.PHONY: prepare
prepare: mod/tidy fmt
.PHONY: clean
clean:
$(GO) clean
rm -f $(COVER_PROFILE) $(COVER_REPORT)
.PHONY: all
all: prepare build lint test