-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
50 lines (36 loc) · 994 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
SHELL := /bin/bash
PATH := bin:$(PATH)
MAIN := main.go
PKG := `go list ./... | grep -v /vendor/`
ifeq ($(RACE),1)
GOFLAGS=-race
endif
VERSION?=$(shell git version > /dev/null 2>&1 && git describe --dirty=-dirty --always 2>/dev/null || echo NO_VERSION)
LDFLAGS=-ldflags "-X=main.version=$(VERSION)"
all: tools fix fmt vet rebuild
tools:
@go get -u github.com/smartystreets/goconvey
@go get -u honnef.co/go/staticcheck/cmd/staticcheck
@go get -u github.com/rancher/trash
fix:
@go get -u .
fmt:
@gofmt -l -w -s `go list -f {{.Dir}}`
vet:
@go vet $(PKG)
@$(GOPATH)/bin/staticcheck $(PKG)
deps:
@$(GOPATH)/bin/trash
rebuild:
@go build -a $(LDFLAGS) $(GOFLAGS) $(MAIN)
build:
@go build $(LDFLAGS) $(GOFLAGS) $(MAIN)
run:
@echo "Compiling"
@go run $(LDFLAGS) $(GOFLAGS) $(MAIN) -config=config.cfg -verbose
test:
@go test $(LDFLAGS) $(GOFLAGS) $(PKG)
test-short:
@go test $(LDFLAGS) $(GOFLAGS) -v -test.short -test.run="Test[^D][^B]" $(PKG)
convey:
@$(GOPATH)/bin/goconvey