forked from ContentSquare/chproxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
40 lines (28 loc) · 818 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
pkgs = $(shell go list ./...)
gofiles := $(shell find . -name "*.go" -type f -not -path "./vendor/*")
BUILD_TAG = $(shell git tag --points-at HEAD)
BUILD_CONSTS = \
-X main.buildTime=`date -u '+%Y-%m-%d_%H:%M:%S'` \
-X main.buildRevision=`git rev-parse HEAD` \
-X main.buildTag=$(BUILD_TAG)
BUILD_OPTS = -ldflags="$(BUILD_CONSTS)" -gcflags="-trimpath=$(GOPATH)/src"
update:
dep ensure -update
format:
go fmt $(pkgs)
gofmt -w -s $(gofiles)
build:
go build
test: build
go test -race $(pkgs)
run: build
./chproxy -config=testdata/http.yml
lint:
go vet $(pkgs)
go list ./... | grep -v /vendor/ | xargs -L1 golint
reconfigure:
kill -HUP `pidof chproxy`
release: format lint test
rm -f chproxy
GOOS=linux GOARCH=amd64 go build $(BUILD_OPTS)
tar czf chproxy-linux-amd64-$(BUILD_TAG).tar.gz chproxy