forked from IBM/sarama
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (45 loc) · 1.1 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
49
50
51
52
53
54
55
56
export GO111MODULE=on
default: fmt vet errcheck test lint
# Taken from https://github.com/codecov/example-go#caveat-multiple-files
.PHONY: test
test:
echo "mode: atomic" > coverage.txt
for d in `go list ./...`; do \
go test -p 1 -v -timeout 6m -race -coverprofile=profile.out -covermode=atomic $$d || exit 1; \
if [ -f profile.out ]; then \
tail +2 profile.out >> coverage.txt; \
rm profile.out; \
fi \
done
GOLINT := $(shell command -v golint)
.PHONY: lint
lint:
ifndef GOLINT
go get golang.org/x/lint/golint
endif
go list ./... | xargs golint
.PHONY: vet
vet:
go vet ./...
ERRCHECK := $(shell command -v errcheck)
# See https://github.com/kisielk/errcheck/pull/141 for details on ignorepkg
.PHONY: errcheck
errcheck:
ifndef ERRCHECK
go get github.com/kisielk/errcheck
endif
errcheck -ignorepkg fmt github.com/Shopify/sarama/...
.PHONY: fmt
fmt:
@if [ -n "$$(go fmt ./...)" ]; then echo 'Please run go fmt on your code.' && exit 1; fi
.PHONY : install_dependencies
install_dependencies: get
.PHONY: get
get:
go get -v ./...
.PHONY: clean
clean:
go clean ./...
.PHONY: tidy
tidy:
go mod tidy -v