-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
49 lines (37 loc) · 902 Bytes
/
Makefile
File metadata and controls
49 lines (37 loc) · 902 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# Makefile for Go server module
# Variables
BINARY_DIR = bin
GO_MODULE = server
SERVER_TEST_CONFIG = "../configs/server-config-local.toml"
# Default target
all: build
# Create bin directory if it doesn't exist
$(BINARY_DIR):
mkdir -p $(BINARY_DIR)
# Build all commands in cmd directory
build: $(BINARY_DIR)
@echo "Building Go binaries..."
@for dir in cmd/*/; do \
if [ -d "$$dir" ] && ls "$$dir"*.go >/dev/null 2>&1; then \
binary_name=$$(basename "$$dir"); \
echo "Building $$binary_name..."; \
go build -o $(BINARY_DIR)/$$binary_name ./$$dir; \
fi; \
done
# Install dependencies
deps:
go mod tidy
go mod download
test: build
./$(BINARY_DIR)/server "$(SERVER_TEST_CONFIG)"
deploy: build
# Format code
fmt:
go fmt ./...
# Vet code
vet:
go vet ./...
# Run linter (requires golangci-lint)
lint:
golangci-lint run
.PHONY: all build clean deps test fmt vet lint dev help