-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
35 lines (33 loc) · 845 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
GOCMD=go
GOFMT1=gofmt
GOFMT2=goreturns
GOFMT3=goimports
GOBUILD=$(GOCMD) build
GOCLEAN=$(GOCMD) clean
GOTEST=$(GOCMD) test
GODOC=$(GOCMD) doc
GOGET=$(GOCMD) get
ifndef PACKAGE
$(error PACKAGE is not set)
endif
default:
@echo "build target is required"
@exit 2
doc:
$(GODOC) -all ./$(PACKAGE)
fmt:
$(GOFMT1) -s -w ./$(PACKAGE)
$(GOFMT2) -l -w ./$(PACKAGE)
$(GOFMT3) -l -w ./$(PACKAGE)
build:
$(GOCMD) build -v ./$(PACKAGE)
test:
$(GOTEST) -v -race -cover -covermode=atomic -coverprofile=coverage.out ./$(PACKAGE)
cat coverage.out >> coverage.txt
testdev:
$(GOTEST) -race -short -cover -covermode=atomic -count 1 ./$(PACKAGE)
bench:
$(GOTEST) -parallel=4 -run="none" -benchtime="2s" -benchmem -bench=. ./$(PACKAGE)
benchdev:
$(GOTEST) -parallel=8 -run="none" -benchtime="3s" -benchmem -bench=. ./$(PACKAGE)
all: build test bench doc