-
Notifications
You must be signed in to change notification settings - Fork 8
/
Makefile
42 lines (34 loc) · 1.06 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
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -euo pipefail -c
.DEFAULT_GOAL := all
BIN_DIR ?= $(shell go env GOPATH)/bin
export PATH := $(PATH):$(BIN_DIR)
.PHONY: deps
deps: ## download go modules
go mod download
.PHONY: fmt
fmt: ## ensure consistent code style
go run oss.indeed.com/go/[email protected] -w .
go run github.com/golangci/golangci-lint/cmd/[email protected] run --fix > /dev/null 2>&1 || true
go mod tidy
.PHONY: lint
lint:
go run github.com/golangci/golangci-lint/cmd/[email protected] run
@if [ -n "$$(go run oss.indeed.com/go/[email protected] -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
go test ./... -race
.PHONY: build
build: ## compile and build artifact
go build .
.PHONY: all
all: test build
.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 '#'