-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
79 lines (63 loc) · 1.49 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Variables
APP_NAME=syscapture
BUILD_DIR=dist
CLIENT_DIR=client
SWAGGER_DIR=docs
# Targets
.PHONY: all build run clean swagger
all: build
# Install dependencies
install:
@echo "Installing dependencies..."
@go mod tidy
@go get -u github.com/swaggo/gin-swagger
@go get -u github.com/swaggo/files
# Build the application
build:
@echo "Building $(APP_NAME), please wait..."
@go build -o $(BUILD_DIR)/$(APP_NAME) ./$(CLIENT_DIR)/main.go
# Run the application
start: build
@echo "Starting $(APP_NAME), please wait..."
@./$(BUILD_DIR)/$(APP_NAME)
dev:
@echo "Starting $(APP_NAME), please wait... "
@go run $(CLIENT_DIR)/main.go
# Run a version check
version:
@echo "Checking for the Version Information"
@go run ./$(BUILD_DIR)/$(APP_NAME) --version
# Clean up build artifacts
clean:
@echo "Cleaning up build artifacts"
@rm -f $(APP_NAME)
@rm -rf $(SWAGGER_DIR)
# Build Documentation for the V2 API Endpoints
docs:
@echo "Generating OpenAPI documentation"
@swag i -g main.go --dir api
@echo "Swagger docs generated in $(SWAGGER_DIR)"
# Install dependencies
deps:
@echo "Installing dependencies..."
@go mod tidy
@go get -u github.com/swaggo/gin-swagger
@go get -u github.com/swaggo/files
# Run tests
test:
@echo "Running tests..."
@go test ./...
# Format code
fmt:
@echo "Formatting code..."
@go fmt ./...
# Lint code
lint:
@echo "Linting code..."
@golint ./...
# Check for errors
vet:
@echo "Checking for errors..."
@go vet ./...
# Run all checks (fmt, lint, vet)
check: fmt lint vet