-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathMakefile
34 lines (23 loc) · 979 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
SRC = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
VERSION := v1.0.0
CHANNEL := $(shell git rev-parse --abbrev-ref HEAD)
CHANNEL_BUILD = $(CHANNEL)-$(shell git rev-parse --short=7 HEAD)
project=github.com/dreamerjackson/crawler
LDFLAGS = -X "github.com/dreamerjackson/crawler/version.BuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
LDFLAGS += -X "github.com/dreamerjackson/crawler/version.GitHash=$(shell git rev-parse HEAD)"
LDFLAGS += -X "github.com/dreamerjackson/crawler/version.GitBranch=$(shell git rev-parse --abbrev-ref HEAD)"
LDFLAGS += -X "github.com/dreamerjackson/crawler/version.Version=${VERSION}"
ifeq ($(gorace), 1)
BUILD_FLAGS=-race
endif
build:
go build -ldflags '$(LDFLAGS)' $(BUILD_FLAGS) main.go
debug:
go build -gcflags=all="-N -l" -ldflags '$(LDFLAGS)' $(BUILD_FLAGS) main.go
lint:
golangci-lint run ./...
imports:
goimports -w .
cover:
go test ./... -v -short -coverprofile .coverage.txt
go tool cover -func .coverage.txt