-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (30 loc) · 843 Bytes
/
Makefile
File metadata and controls
37 lines (30 loc) · 843 Bytes
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
SRC_FILES := $(shell git ls-files | grep -E "\.go$$" | grep -v -E "\.pb(:?\.gw)?\.go$$")
PKGS = $(shell go list ./... | grep -v -E "/vendor/")
GO_TEST_FLAGS := -v -race -coverprofile=coverage.txt -covermode=atomic
DEP_COMMANDS := \
vendor/github.com/golang/protobuf/protoc-gen-go
# Commands
#-----------------------------------------------
.PHONY: dep
dep:
@go mod download
@GOBIN="$$PWD/bin"; \
pkgs="$(DEP_COMMANDS)"; \
for pkg in $$pkgs; do \
cd $$pkg; \
go install .; \
cd -; \
done
.PHONY: gen
gen: $(SRC_FILES)
@PATH=$$PWD/bin:$$PATH go generate $(PKGS)
.PHONY: lint
lint:
@gofmt -e -d -s $(SRC_FILES) | awk '{ e = 1; print $0 } END { if (e) exit(1) }'
@echo $(SRC_FILES) | xargs -n1 golint -set_exit_status
@go vet $(PKGS)
.PHONY: test
test: gen ci-test
.PHONY: ci-test
ci-test: lint
@go test $(GO_TEST_FLAGS)