-
Notifications
You must be signed in to change notification settings - Fork 127
/
Makefile
66 lines (54 loc) · 1.49 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# Author: Rohith ([email protected])
# Date: 2015-02-10 15:35:14 +0000 (Tue, 10 Feb 2015)
#
# vim:ts=2:sw=2:et
#
HARDWARE=$(shell uname -m)
VERSION=$(shell awk '/const Version/ { print $$4 }' version.go | sed 's/"//g')
DEPS=$(shell go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
PACKAGES=$(shell go list ./...)
VETARGS?=-asmdecl -atomic -bool -buildtags -copylocks -methods -nilfunc -printf -rangeloops -shift -structtags -unsafeptr
.PHONY: test examples changelog check-format coverage cover
build:
go build
deps:
@echo "--> Installing build dependencies"
@go get -d -v ./... $(DEPS)
lint:
@echo "--> Running golint"
@which golint 2>/dev/null ; if [ $$? -eq 1 ]; then \
go get -u github.com/golang/lint/golint; \
fi
@golint .
vet:
@echo "--> Running go tool vet $(VETARGS) ."
@go tool vet 2>/dev/null ; if [ $$? -eq 3 ]; then \
go get golang.org/x/tools/cmd/vet; \
fi
@go tool vet $(VETARGS) .
cover:
@echo "--> Running go test --cover"
@go test --cover
coverage:
@echo "--> Running go coverage"
@go test -covermode=count -coverprofile=coverage
format:
@echo "--> Running go fmt"
@go fmt $(PACKAGES)
check-format:
@echo "--> Checking format"
@if gofmt -l . 2>&1 | grep -q '.go'; then \
echo "found unformatted files:"; \
echo; \
gofmt -l .; \
exit 1; \
fi
test: deps vet
@echo "--> Running go tests"
@go test -race -v
@$(MAKE) cover
examples:
make -C examples all
changelog: release
git log $(shell git tag | tail -n1)..HEAD --no-merges --format=%B > changelog