-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathMakefile
48 lines (33 loc) · 1.21 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
APPLICATION_NAME := github.com/allegro/mesos-executor
APPLICATION_VERSION := $(shell git describe --tags || echo "unknown")
LDFLAGS := -X main.Version=$(APPLICATION_VERSION)
GO_BUILD := go build -v -ldflags "$(LDFLAGS)" -a
CURRENT_DIR = $(shell pwd)
PATH := $(CURRENT_DIR)/bin:$(PATH)
.PHONY: clean test all build package deps lint lint-deps \
generate-source generate-source-deps
all: lint test build
build: target
$(GO_BUILD) -o target/executor ./cmd/executor
target:
mkdir target
clean:
go clean -v .
rm -rf target
rm -rf $(CURRENT_DIR)/bin
generate-source: generate-source-deps
go generate -v $$(go list ./... | grep -v /vendor/)
generate-source-deps:
go get -v -u golang.org/x/tools/cmd/stringer
lint: lint-deps
golangci-lint run --config=golangcilinter.yaml ./...
lint-deps:
@which golangci-lint > /dev/null || \
(GO111MODULE=on go get -v github.com/golangci/golangci-lint/cmd/[email protected])
package: target/executor
zip -j target/executor-$(APPLICATION_VERSION)-linux-amd64.zip target/executor
chmod 0755 target/executor-$(APPLICATION_VERSION)-linux-amd64.zip
test: test-deps
go test -coverprofile=target/coverage.txt -covermode=atomic ./...
test-deps: target
./scripts/install-consul.sh