-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (35 loc) · 960 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
GO = go
GOFMT = go fmt
GOLINT = golint
GOVERALLS = goveralls
GOVERALLS_ARGS = -service=travis-ci
GORELEASER = goreleaser
BUILD_DATE := $(shell date +'%Y-%m-%d_%H:%M:%S')
BUILD_COMMIT := $(shell git show -q --format='%H' HEAD)
PACKAGE = nagocheck
TARGET = $(CURDIR)/dist/$(PACKAGE)
PKGS = $(shell $(GO) list ./... | grep -v "$(PACKAGE)/shared")
.PHONY: all
all: lint test build
.PHONY: build
build:
$(GO) build \
-ldflags "-X main.BuildDate=$(BUILD_DATE) -X main.BuildCommit=$(BUILD_COMMIT)" \
-o $(TARGET) .
.PHONY: devel-deps
devel-deps:
$(GO) get golang.org/x/lint/golint
$(GO) get github.com/mattn/goveralls
.PHONY: lint
lint: devel-deps
$(GO) vet ./...
$(GOLINT) -set_exit_status ./...
.PHONY: test
test: devel-deps
$(GO) test -v ./...
.PHONY: coverage
coverage: devel-deps
$(GOVERALLS) $(GOVERALLS_ARGS)
.PHONY: snapshot
snapshot: devel-deps
$(GORELEASER) --snapshot --skip-publish --rm-dist