generated from accelerator-blueprints/base-blueprint
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
51 lines (39 loc) · 1.11 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
SHELL := /bin/bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
PKG_LIST := $(shell go list ./...)
.PHONY: run test target fmt
PARAM ?= --help
help:
@printf "Usage: make [target] [VARIABLE=value]\nTargets:\n"
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
hooks: ## Setup pre commit.
@pre-commit install
@pre-commit gc
@pre-commit autoupdate
validate: ## Validate files with pre-commit hooks
@pre-commit run --all-files
deps: ## Update dependencies
@go mod tidy -v
diff: ## Show diff
@git diff HEAD
@git diff-index --quiet HEAD
fmt: ## Run gofmt on goimports all files
gofmt -w -l -s .
goimports -w -l .
build: ## Build go libraries
@go build main.go
run-help:## Run help
@go run main.go context --help
test: ## Run unit tests
go clean -testcache ${PKG_LIST}
go test -v -p 1 -short -race ${PKG_LIST}
run: ## Run cli ARGS=--list-roles mk run
ifndef ARGS
$(info ARGS not set!!)
go run main.go --help
else
go run main.go $(ARGS)
endif