- Initialize go.mod with module path kode.naiv.no/olemd/forgejo-mcp-broker
- Create directory layout: cmd/broker + internal/{buildinfo,config,log,store,httpserver}
- Add Makefile with build/test/lint/tidy/clean targets and ldflags-injected build info
- Stub cmd/broker/main.go with --version support; real wiring follows in -t37
- Stub doc.go for each internal/* package, pointing to the issue that fills it in
Closes forgejo-mcp-broker-n84.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
Makefile
39 lines
1.3 KiB
Makefile
# forgejo-mcp-broker Makefile
|
|
|
|
BINARY := fjmcp-broker
|
|
CMD_PKG := ./cmd/broker
|
|
MODULE := kode.naiv.no/olemd/forgejo-mcp-broker
|
|
VERSION := $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
GIT_REV := $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
|
BUILD_DATE := $(shell date -u +%Y-%m-%dT%H:%M:%SZ)
|
|
LDFLAGS := -s -w \
|
|
-X $(MODULE)/internal/buildinfo.Version=$(VERSION) \
|
|
-X $(MODULE)/internal/buildinfo.GitRevision=$(GIT_REV) \
|
|
-X $(MODULE)/internal/buildinfo.BuildDate=$(BUILD_DATE)
|
|
|
|
.PHONY: all build test lint tidy clean help
|
|
|
|
all: build
|
|
|
|
build: ## Build the broker binary
|
|
go build -trimpath -ldflags '$(LDFLAGS)' -o $(BINARY) $(CMD_PKG)
|
|
|
|
test: ## Run tests with the race detector
|
|
go test -race ./...
|
|
|
|
lint: ## Static analysis (go vet; golangci-lint if installed)
|
|
go vet ./...
|
|
@if command -v golangci-lint >/dev/null 2>&1; then \
|
|
golangci-lint run; \
|
|
else \
|
|
echo "golangci-lint not installed; skipping (go vet already ran)"; \
|
|
fi
|
|
|
|
tidy: ## Tidy go.mod / go.sum
|
|
go mod tidy
|
|
|
|
clean: ## Remove build artefacts
|
|
rm -f $(BINARY)
|
|
|
|
help: ## Show available targets
|
|
@awk 'BEGIN {FS = ":.*##"; print "Targets:"} /^[a-zA-Z_-]+:.*?##/ { printf " %-8s %s\n", $$1, $$2 }' $(MAKEFILE_LIST)
|