Add Makefile with check, lint, test, fmt targets
- check: default target, runs fmt-check, lint, and test - fmt-check: verifies code is properly formatted - fmt: formats code with gofmt - lint: runs golangci-lint - test: runs go test - build: builds pixad binary with version info - clean: removes build artifacts
This commit is contained in:
parent
12f6f6fe75
commit
4ef9141960
38
Makefile
Normal file
38
Makefile
Normal file
@ -0,0 +1,38 @@
|
||||
.PHONY: check lint test fmt build clean
|
||||
|
||||
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
|
||||
BUILDARCH := $(shell go env GOARCH)
|
||||
LDFLAGS := -X main.Version=$(VERSION) -X main.Buildarch=$(BUILDARCH)
|
||||
|
||||
# Default target: run all checks
|
||||
check: fmt-check lint test
|
||||
|
||||
# Check formatting without modifying files
|
||||
fmt-check:
|
||||
@echo "Checking formatting..."
|
||||
@test -z "$$(gofmt -l .)" || (echo "Files need formatting:"; gofmt -l .; exit 1)
|
||||
|
||||
# Format code
|
||||
fmt:
|
||||
@echo "Formatting code..."
|
||||
gofmt -w .
|
||||
|
||||
# Run linter
|
||||
lint:
|
||||
@echo "Running linter..."
|
||||
golangci-lint run
|
||||
|
||||
# Run tests
|
||||
test:
|
||||
@echo "Running tests..."
|
||||
go test -v ./...
|
||||
|
||||
# Build the binary
|
||||
build:
|
||||
@echo "Building pixad..."
|
||||
go build -ldflags "$(LDFLAGS)" -o bin/pixad ./cmd/pixad
|
||||
|
||||
# Clean build artifacts
|
||||
clean:
|
||||
rm -rf bin/
|
||||
rm -f data.db
|
||||
2
TODO.md
2
TODO.md
@ -3,7 +3,7 @@
|
||||
A single linear checklist of tasks to implement the complete pixa caching image reverse proxy server.
|
||||
|
||||
## Project Setup
|
||||
- [ ] Create Makefile with check, lint, test, fmt targets
|
||||
- [x] Create Makefile with check, lint, test, fmt targets
|
||||
- [ ] Create project structure (cmd/pixad, internal/*)
|
||||
- [ ] Implement globals package
|
||||
- [ ] Implement logger package
|
||||
|
||||
Loading…
Reference in New Issue
Block a user