mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
58 lines
1.5 KiB
Makefile
58 lines
1.5 KiB
Makefile
.PHONY: all build swagger test clean dev
|
|
|
|
# Default target
|
|
all: swagger build
|
|
|
|
# Generate swagger documentation using go run (no install needed)
|
|
swagger:
|
|
@echo "Generating Swagger documentation..."
|
|
go run github.com/swaggo/swag/cmd/swag@latest init -g cmd/server/main.go -o docs --parseDependency --parseInternal
|
|
|
|
# Build the binary
|
|
build: swagger
|
|
@echo "Building ez-api..."
|
|
go build -o ez-api ./cmd/server
|
|
|
|
# Build without swagger regeneration (for quick iteration)
|
|
build-fast:
|
|
go build -o ez-api ./cmd/server
|
|
|
|
# Run tests
|
|
test:
|
|
go test -v ./...
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
rm -f ez-api
|
|
rm -rf docs/
|
|
|
|
# Run in development mode
|
|
dev: swagger
|
|
go run ./cmd/server
|
|
|
|
# Format code
|
|
fmt:
|
|
go fmt ./...
|
|
|
|
# Lint code
|
|
lint:
|
|
@which golangci-lint > /dev/null || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
|
golangci-lint run
|
|
|
|
# Generate swagger only (alias)
|
|
docs: swagger
|
|
|
|
# Help
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " all - Generate swagger docs and build (default)"
|
|
@echo " build - Generate swagger and build binary"
|
|
@echo " build-fast - Build binary without swagger regeneration"
|
|
@echo " swagger - Generate Swagger documentation"
|
|
@echo " docs - Alias for swagger"
|
|
@echo " test - Run tests"
|
|
@echo " dev - Run in development mode"
|
|
@echo " clean - Remove build artifacts"
|
|
@echo " fmt - Format code"
|
|
@echo " lint - Run linter"
|
|
@echo " help - Show this help"
|