-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
63 lines (51 loc) · 1.55 KB
/
Copy pathMakefile
File metadata and controls
63 lines (51 loc) · 1.55 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
# Makefile para Anotador
# Un anotador web minimalista
.PHONY: all build run test clean fmt lint help
# Variables
BINARY_NAME=anotador
CMD_PATH=./cmd/server
BUILD_DIR=./build
# Colores para output
GREEN=\033[0;32m
NC=\033[0m # No Color
# Comando por defecto
all: fmt test build
## build: Compila el binario
build:
@echo "$(GREEN)🔨 Compilando...$(NC)"
@mkdir -p $(BUILD_DIR)
@go build -o $(BUILD_DIR)/$(BINARY_NAME) $(CMD_PATH)
@echo "$(GREEN)✓ Binario creado en $(BUILD_DIR)/$(BINARY_NAME)$(NC)"
## run: Ejecuta la aplicación
run:
@echo "$(GREEN)🚀 Iniciando servidor...$(NC)"
@go run $(CMD_PATH)/main.go
## test: Ejecuta todos los tests
test:
@echo "$(GREEN)🧪 Ejecutando tests...$(NC)"
@go test -v -race ./...
## test-coverage: Ejecuta tests con cobertura
test-coverage:
@echo "$(GREEN)📊 Ejecutando tests con cobertura...$(NC)"
@go test -v -race -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "$(GREEN)✓ Reporte generado en coverage.html$(NC)"
## fmt: Formatea el código
fmt:
@echo "$(GREEN)✨ Formateando código...$(NC)"
@go fmt ./...
## lint: Ejecuta el linter (requiere golangci-lint)
lint:
@echo "$(GREEN)🔍 Ejecutando linter...$(NC)"
@golangci-lint run ./...
## clean: Limpia archivos generados
clean:
@echo "$(GREEN)🧹 Limpiando...$(NC)"
@rm -rf $(BUILD_DIR)
@rm -f coverage.out coverage.html
@echo "$(GREEN)✓ Limpieza completada$(NC)"
## help: Muestra esta ayuda
help:
@echo "Comandos disponibles:"
@echo ""
@sed -n 's/^##//p' $(MAKEFILE_LIST) | column -t -s ':' | sed -e 's/^/ /'