-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
54 lines (43 loc) · 996 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
44
45
46
47
48
49
50
51
52
53
54
OS=$(shell uname -s)
# Setup and run app
all: setup install run
.PHONY: all
# Install required tools
setup:
go get -u gopkg.in/alecthomas/gometalinter.v2
ifeq ($(OS), Darwin)
brew install dep
else
curl https://github.com/raw/golang/dep/master/install.sh | sh
endif
gometalinter.v2 --install
.PHONY: setup
# Install dependencies
install:
dep ensure -v -vendor-only
.PHONY: install
# Run app
run:
go run main.go
.PHONY: run
# Run tests
test:
go test -race -v ./...
.PHONY: test
# Run tests and show code coverage
cover:
go test -race -v -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt ./...
go tool cover -html=coverage.txt
.PHONY: cover
# Run linters
lint:
gometalinter.v2 --vendor --deadline 60s ./...
.PHONY: lint
# Build staticailly linked binary
build:
CGO_ENABLED=0 go build -ldflags="-s -w"
.PHONY: build
# Test and lint code
ci: test lint
.DEFAULT_GOAL := build
.SILENT: # this has no purpose but to prevent echoing of commands for all targets