# Email Agent — developer commands. # # Go is not installed on the host in every environment; the docker-* targets # run the same commands inside the pinned golang image. GO ?= go IMAGE ?= email-agent:dev PKG := ./... .PHONY: help tidy fmt vet build test run clean docker-build docker-up docker-down docker-logs docker-test help: ## List targets @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN{FS=":.*?## "}{printf " %-16s %s\n", $$1, $$2}' tidy: ## Sync go.mod/go.sum $(GO) mod tidy fmt: ## Format Go sources $(GO) fmt $(PKG) vet: ## Run go vet $(GO) vet $(PKG) build: ## Build the binary into ./bin CGO_ENABLED=0 $(GO) build -trimpath -o bin/email-agent ./cmd/email-agent test: ## Run tests $(GO) test $(PKG) run: ## Run locally with defaults (db in ./data) $(GO) run ./cmd/email-agent clean: ## Remove build artifacts rm -rf bin data # --- Docker (works without a host Go toolchain) ---------------------------- docker-build: ## Build the container image docker build -t $(IMAGE) . docker-up: ## Start the stack docker compose up -d --build docker-down: ## Stop the stack docker compose down docker-logs: ## Follow logs docker compose logs -f docker-test: ## Run go build + vet + test inside the golang image docker run --rm -v "$(CURDIR)":/src -w /src -e CGO_ENABLED=0 golang:1.25-alpine \ sh -c "apk add --no-cache git >/dev/null && go mod download && go build $(PKG) && go vet $(PKG) && go test $(PKG)"