forked from open-telemetry/opentelemetry-log-collection
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
61 lines (47 loc) · 1.26 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
57
58
59
60
61
GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
GIT_SHA=$(shell git rev-parse --short HEAD)
PROJECT_ROOT = $(shell pwd)
ARTIFACTS = ${PROJECT_ROOT}/artifacts
ALL_MODULES := $(shell find . -type f -name "go.mod" -exec dirname {} \; | sort )
.PHONY: install-tools
install-tools:
go install github.com/golangci/golangci-lint/cmd/golangci-lint
go install github.com/vektra/mockery/cmd/mockery
.PHONY: test
test: vet test-only
.PHONY: test-only
test-only:
$(MAKE) for-all CMD="go test -race -coverprofile coverage.txt -coverpkg ./... ./..."
.PHONY: bench
bench:
$(MAKE) for-all CMD="go test -run=NONE -bench '.*' ./... -benchmem"
.PHONY: clean
clean:
rm -fr ./artifacts
$(MAKE) for-all CMD="rm -f coverage.txt coverage.html"
.PHONY: tidy
tidy:
$(MAKE) for-all CMD="rm -fr go.sum"
$(MAKE) for-all CMD="go mod tidy"
.PHONY: listmod
listmod:
@set -e; for dir in $(ALL_MODULES); do \
(echo "$${dir}"); \
done
.PHONY: lint
lint:
golangci-lint run ./...
.PHONY: vet
vet:
GOOS=darwin $(MAKE) for-all CMD="go vet ./..."
GOOS=linux $(MAKE) for-all CMD="go vet ./..."
GOOS=windows $(MAKE) for-all CMD="go vet ./..."
.PHONY: generate
generate:
go generate ./...
.PHONY: for-all
for-all:
@set -e; for dir in $(ALL_MODULES); do \
(cd "$${dir}" && $${CMD} ); \
done