33 lines
724 B
Makefile
33 lines
724 B
Makefile
# Makefile — common tasks for local development
|
|
|
|
.PHONY: run build test migrate seed lint
|
|
|
|
## Start the server (auto-reloads with 'air' if installed)
|
|
run:
|
|
@which air > /dev/null 2>&1 && air || go run ./cmd/server
|
|
|
|
## Build a binary
|
|
build:
|
|
go build -o bin/server ./cmd/server
|
|
|
|
## Run all tests
|
|
test:
|
|
go test ./... -v
|
|
|
|
## Apply the latest SQL migration
|
|
migrate:
|
|
psql $$DATABASE_URL -f migrations/001_initial.sql
|
|
|
|
## Run the server with the race detector (finds concurrency bugs)
|
|
race:
|
|
go run -race ./cmd/server
|
|
|
|
## Lint (requires golangci-lint)
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
## Install dev tools
|
|
tools:
|
|
go install github.com/cosmtrek/air@latest
|
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|