-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
66 lines (50 loc) · 1.23 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
62
63
64
65
66
SHELL = bash
BENCHFLAGS = -gcflags '-l' -benchmem -bench=. -benchtime 5s
GO_MODULE_DIRS ?= $(shell go list -m -f "{{ .Dir }}" | grep -v mod-vendor)
mkfile_path := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
GOLANGCI_CONFIG_DIR ?= $(mkfile_path)
TIMEOUT ?= 10s
GOFILES = $(shell find -type f -name '*.go' ! -name '*.pb.go')
.PHONY: dev
dev:
./run-dev.sh
build:
go build ./cmd/protoc-gen-go-telemetry
.PHONY: test
test: go/test/mod
.PHONY: lint
lint: go/lint/mod
.PHONY: tidy
tidy: go/tidy/mod
.PHONY: fmt
fmt: $(GOFILES)
@echo "Running goimports -w"
@goimports -w $^
.PHONY: $(GO_MODULE_DIRS)
$(GO_MODULE_DIRS):
@echo -e "Running $(TARGET) for $(@)\n"
make -k -f $(CURDIR)/Makefile -C $@ $(TARGET)
.PHONY: go/test/mod go/test
go/test/mod: TARGET=go/test
go/test/mod: $(GO_MODULE_DIRS)
go/test:
@go test -timeout $(TIMEOUT) ./...
.PHONY: go/lint/mod go/lint
go/lint/mod: TARGET=go/lint fmt
go/lint/mod: $(GO_MODULE_DIRS)
go/lint:
@golangci-lint run --fix --config $(GOLANGCI_CONFIG_DIR)/.golangci.yml
.PHONY: go/tidy/mod go/tidy
go/tidy/mod: TARGET=go/tidy
go/tidy/mod: $(GO_MODULE_DIRS)
go/tidy:
go mod tidy
.PHONY: bench
bench:
go test $(BENCHFLAGS) ./test/...
.PHONY: generate
generate:
@ ( \
cd test ; \
./generate.bash ; \
);