-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (36 loc) · 1.01 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
BINPATH ?= build
BUILD_TIME=$(shell date +%s)
GIT_COMMIT=$(shell git rev-parse HEAD)
VERSION ?= $(shell git tag --points-at HEAD | grep ^v | head -n 1)
LDFLAGS = -ldflags "-X main.BuildTime=$(BUILD_TIME) -X main.GitCommit=$(GIT_COMMIT) -X main.Version=$(VERSION)"
.PHONY: all
all: audit test build
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: audit
audit:
go list -m all | nancy sleuth
.PHONY: build
build:
go build -tags 'production' $(LDFLAGS) -o $(BINPATH)/dp-search-data-finder
.PHONY: lint
lint:
go install github.com/golangci/golangci-lint/cmd/[email protected]
golangci-lint run ./...
.PHONY: debug
debug:
go build -tags 'debug' $(LDFLAGS) -o $(BINPATH)/dp-search-data-finder
HUMAN_LOG=1 DEBUG=1 $(BINPATH)/dp-search-data-finder
.PHONY: test
test:
go test -race -cover -count=1 ./...
.PHONY: produce
produce:
HUMAN_LOG=1 go run cmd/producer/main.go
.PHONY: convey
convey:
goconvey ./...
.PHONY: test-component
test-component:
go test -cover -coverpkg=github.com/ONSdigital/dp-search-data-finder/... -component