-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
41 lines (32 loc) · 993 Bytes
/
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
build: # Build the application
@go build -o bin/main cmd/main.go
run: # Run the application
@go run cmd/main.go
test: # Run tests
@go test ./... -v -cover
db-up: # Start database container
@docker compose up -d mongo
db-down: # Stop database container
@docker compose down mongo
clean: # Clean the binary
@go clean
@rm -rf bin
watch: # Live reload
@if command -v air > /dev/null; then \
air; \
else \
echo "installing air..."; \
go install github.com/air-verse/air@latest; \
air; \
fi
lint: # Lint
@if command -v golangci-lint > /dev/null; then \
golangci-lint run ./...; \
else \
echo "installing golangci-lint..."; \
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
golangci-lint run ./...; \
fi
help: # Print help
@grep -E '^[a-zA-Z0-9 -]+:.*#' Makefile | sort | while read -r l; do printf "\033[1;32m$$(echo $$l | cut -f 1 -d':')\033[00m:$$(echo $$l | cut -f 2- -d'#')\n"; done
.PHONY: run test db-up db-down clean lint help