-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathMakefile
43 lines (33 loc) · 849 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
export GOBIN ?= $(shell pwd)/bin
GOLINT = $(GOBIN)/golint
GO_FILES := $(shell \
find . '(' -path '*/.*' -o -path './vendor' ')' -prune \
-o -name '*.go' -print | cut -b3-)
.PHONY: build
build:
go build ./...
.PHONY: test
test:
go test -race ./...
.PHONY: cover
cover:
go test -coverprofile=cover.out -coverpkg=./... -v ./...
go tool cover -html=cover.out -o cover.html
.PHONY: lint
lint: gofmt govet golint
.PHONY: govet
@echo "Running govet"
@go vet ./...
.PHONY: gofmt
gofmt:
@echo "Running gofmt"
$(eval FMT_LOG := $(shell mktemp -t gofmt.XXXXX))
@gofmt -e -s -l $(GO_FILES) > $(FMT_LOG) || true
@[ ! -s "$(FMT_LOG)" ] || (echo "gofmt failed:" | cat - $(FMT_LOG) && false)
.PHONY: golint
golint: $(GOLINT)
@echo "Running golint"
@$(GOLINT) ./...
$(GOLINT):
@echo "Installing golint"
@go install golang.org/x/lint/golint