-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (20 loc) · 857 Bytes
/
Makefile
File metadata and controls
31 lines (20 loc) · 857 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
.DEFAULT_GOAL := help
VERSION ?= dev
VERSION_NUM = $(patsubst v%,%,$(VERSION))
MODULE = github.com/ppiankov/mongopulse
LDFLAGS = -s -w -X $(MODULE)/internal/cli.version=$(VERSION_NUM)
.PHONY: build test lint fmt docker verify all help
build: ## Build binary
go build -ldflags="$(LDFLAGS)" -o bin/mongopulse ./cmd/mongopulse
test: ## Run tests with race detection
go test -race -v ./internal/...
lint: ## Run golangci-lint
golangci-lint run ./...
fmt: ## Format code
gofmt -w cmd/ internal/
docker: ## Build Docker image
docker build --build-arg VERSION=$(VERSION) -t mongopulse:$(VERSION_NUM) .
verify: build test lint ## Build, test, lint
all: fmt lint test build
help: ## Show this help
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'