-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
39 lines (32 loc) · 1.05 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
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -euo pipefail -c
.DEFAULT_GOAL := all
RUN_GO_GROUPS := go run oss.indeed.com/go/[email protected]
RUN_GO_OPINE := go run oss.indeed.com/go/[email protected]
RUN_GOLANGCI_LINT := go run github.com/golangci/golangci-lint/cmd/[email protected]
.PHONY: deps
deps: ## download go modules
go mod download
.PHONY: fmt
fmt: ## ensure consistent code style
$(RUN_GO_GROUPS) -w .
$(RUN_GOLANGCI_LINT) run --fix > /dev/null 2>&1 || true
go mod tidy
.PHONY: lint
lint: ## run golangci-lint
$(RUN_GOLANGCI_LINT) run
@if [ -n "$$($(RUN_GO_GROUPS) -l .)" ]; then \
echo -e "\033[0;33mdetected fmt problems: run \`\033[0;32mmake fmt\033[0m\033[0;33m\`\033[0m"; \
exit 1; \
fi
.PHONY: test
test: lint ## run go tests
$(RUN_GO_OPINE) test -coverprofile=cover.out -junit=report.xml
.PHONY: all
all: test
.PHONY: help
help: ## displays this help message
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_\/-]+:.*?## / {printf "\033[34m%-12s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
sort | \
grep -v '#'