-
Notifications
You must be signed in to change notification settings - Fork 3
/
makefile
44 lines (31 loc) · 1.1 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
SHELL := /bin/bash
.PHONY: all build test deps deps-cleancache
GOCMD=go
BUILD_DIR=build
BINARY_DIR=$(BUILD_DIR)/bin
CODE_COVERAGE=code-coverage
all: test build
${BINARY_DIR}:
mkdir -p $(BINARY_DIR)
build: ${BINARY_DIR} ## Compile the code, build Executable File
$(GOCMD) build -o api -v ./cmd/api
run: ## Start application
$(GOCMD) run ./cmd/api
test: ## Run tests
$(GOCMD) test ./... -cover
test-coverage: ## Run tests and generate coverage file
$(GOCMD) test ./... -coverprofile=$(CODE_COVERAGE).out
$(GOCMD) tool cover -html=$(CODE_COVERAGE).out
deps: ## Install dependencies
# go get $(go list -f '{{if not (or .Main .Indirect)}}{{.Path}}{{end}}' -m all)
$(GOCMD) get -u -t -d -v ./...
$(GOCMD) mod tidy
$(GOCMD) mod vendor
deps-cleancache: ## Clear cache in Go module
$(GOCMD) clean -modcache
wire: ## Generate wire_gen.go
cd pkg/di && wire
swag: ## Generate swagger docs
swag init -g pkg/api/handler/admin.go -o ./cmd/api/docs
help: ## Display this help screen
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'