89 lines
2.1 KiB
Makefile
89 lines
2.1 KiB
Makefile
.PHONY: build clean wipe test help
|
|
|
|
# Default target
|
|
all: build
|
|
|
|
# Build the binary
|
|
build:
|
|
@echo "Building s3-genindex..."
|
|
go build -o s3-genindex ./cmd/s3-genindex
|
|
@echo "Build complete: s3-genindex"
|
|
|
|
# Run tests
|
|
test:
|
|
@echo "Running tests..."
|
|
go test -v ./...
|
|
@echo "Tests complete"
|
|
|
|
# Run tests with coverage
|
|
test-coverage:
|
|
@echo "Running tests with coverage..."
|
|
go test -v -coverprofile=coverage.out ./...
|
|
go tool cover -html=coverage.out -o coverage.html
|
|
@echo "Coverage report generated: coverage.html"
|
|
|
|
# Clean build artifacts
|
|
clean:
|
|
@echo "Cleaning build artifacts..."
|
|
rm -f s3-genindex
|
|
rm -f coverage.out coverage.html
|
|
@echo "Clean complete"
|
|
|
|
# Wipe everything including test caches
|
|
wipe: clean
|
|
@echo "Wiping test cache and module cache..."
|
|
go clean -testcache
|
|
go clean -modcache
|
|
@echo "Wipe complete"
|
|
|
|
# Install binary to $GOPATH/bin or $GOBIN
|
|
install:
|
|
@echo "Installing s3-genindex..."
|
|
go install ./cmd/s3-genindex
|
|
@echo "Install complete"
|
|
|
|
# Format code
|
|
fmt:
|
|
@echo "Formatting code..."
|
|
go fmt ./...
|
|
@echo "Format complete"
|
|
|
|
# Vet code for issues
|
|
vet:
|
|
@echo "Vetting code..."
|
|
go vet ./...
|
|
@echo "Vet complete"
|
|
|
|
# Lint code (requires golangci-lint)
|
|
lint:
|
|
@echo "Linting code..."
|
|
@if command -v golangci-lint >/dev/null 2>&1; then \
|
|
golangci-lint run; \
|
|
else \
|
|
echo "golangci-lint not found, skipping lint"; \
|
|
fi
|
|
|
|
# Run all checks
|
|
check: fmt vet lint test
|
|
@echo "All checks passed"
|
|
|
|
# Run benchmarks
|
|
bench:
|
|
@echo "Running benchmarks..."
|
|
go test -bench=. ./...
|
|
|
|
# Show help
|
|
help:
|
|
@echo "Available targets:"
|
|
@echo " build - Build the s3-genindex binary"
|
|
@echo " test - Run all tests"
|
|
@echo " test-coverage - Run tests with coverage report"
|
|
@echo " clean - Remove build artifacts"
|
|
@echo " wipe - Clean everything including caches"
|
|
@echo " install - Install binary to GOPATH/bin"
|
|
@echo " fmt - Format code"
|
|
@echo " vet - Vet code for issues"
|
|
@echo " lint - Lint code (requires golangci-lint)"
|
|
@echo " check - Run fmt, vet, lint, and test"
|
|
@echo " bench - Run benchmarks"
|
|
@echo " help - Show this help message"
|