-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (50 loc) · 1.19 KB
/
Makefile
File metadata and controls
63 lines (50 loc) · 1.19 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!make
GO_BIN ?= go
GOFMT ?= gofmt
GOIMPORTS ?= goimports
GOLINT ?= golangci-lint
SOURCE_FILES ?= ./...
export GO111MODULE := on
.PHONY: setup
setup:
echo $$(go env GOPATH)
cd $$(go env GOPATH)/src/github.com/golangci/golangci-lint/cmd/golangci-lint
go install -ldflags "-X 'main.version=$$(git describe --tags)' -X 'main.commit=$$(git rev-parse --short HEAD)' -X 'main.date=$$(date)'"
go get -u github.com/goreleaser/goreleaser
.PHONY: mod
mod:
$(GO_BIN) mod download
.PHONY: test
test: mod
$(GO_BIN) test -v -failfast -race -coverpkg=./... -covermode=atomic -coverprofile=coverage.out $(SOURCE_FILES) -timeout=5m
.PHONY: cover
cover: test
$(GO_BIN) tool cover -html=coverage.out
.PHONY: lint
lint:
$(GOLINT) run ./...
.PHONY: vet
vet:
$(GO_BIN) vet ./...
.PHONY: fmt
fmt:
find . -name '*.go' -not -wholename './vendor/*' | \
while read -r file; do \
$(GOFMT) -w -s "$$file"; \
$(GOIMPORTS) -w "$$file"; \
done
.PHONY: build
build: mod
$(GO_BIN) build -o drm .
.PHONY: dist
dist:
goreleaser release --skip-publish --snapshot --rm-dist
.PHONY: todo
todo:
@grep \
--exclude-dir=vendor \
--exclude=Makefile \
--text \
--color \
-nRo -E ' TODO.*' .
.DEFAULT_GOAL := build