All checks were successful
check / check (push) Successful in 8s
Brings the repository into compliance with REPO_POLICIES standards. Closes [issue #39](#39). ## Changes ### Added files - **REPO_POLICIES.md** — fetched from `sneak/prompts` (last_modified: 2026-02-22) - **.editorconfig** — fetched from `sneak/prompts`, enforces 4-space indents (tabs for Makefile) - **.dockerignore** — standard Go exclusions (.git/, bin/, *.md, LICENSE, .editorconfig, .gitignore) ### Makefile updates - Added `fmt-check` target (read-only gofmt check) - Added `hooks` target (installs pre-commit hook running `make check`) - Added `docker` target (runs `docker build .`) - Added `-timeout 30s` to both `test` and `check` targets - Updated `.PHONY` list with all new targets ### Removed files - **CLAUDE.md** — superseded by REPO_POLICIES.md - **CONVENTIONS.md** — superseded by REPO_POLICIES.md ### README updates - First line now includes project name, purpose, category (daemon), and author per REPO_POLICIES format - Updated CONVENTIONS.md reference to REPO_POLICIES.md - Added **License** section (pending author choice) - Added **Author** section: [@sneak](https://sneak.berlin) ### Intentionally skipped - **LICENSE file** — not created; license choice (MIT, GPL, or WTFPL) requires sneak's input ## Verification - `docker build .` passes (all checks green: fmt, lint, tests, build) - No changes to `.golangci.yml`, test assertions, or linter config Co-authored-by: clawbot <clawbot@noreply.git.eeqj.de> Co-authored-by: Jeffrey Paul <sneak@noreply.example.org> Reviewed-on: #40 Co-authored-by: clawbot <clawbot@noreply.example.org> Co-committed-by: clawbot <clawbot@noreply.example.org>
50 lines
1.3 KiB
Makefile
50 lines
1.3 KiB
Makefile
.PHONY: all build lint fmt fmt-check test check clean hooks docker
|
|
|
|
BINARY := dnswatcher
|
|
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)
|
|
|
|
all: check build
|
|
|
|
build:
|
|
go build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/dnswatcher
|
|
|
|
lint:
|
|
golangci-lint run --config .golangci.yml ./...
|
|
|
|
fmt:
|
|
gofmt -s -w .
|
|
goimports -w .
|
|
|
|
fmt-check:
|
|
@test -z "$$(gofmt -l .)" || (echo "gofmt: files not formatted:" && gofmt -l . && exit 1)
|
|
|
|
test:
|
|
go test -v -race -timeout 30s -cover ./...
|
|
|
|
# Check runs all validation without making changes
|
|
# Used by CI and Docker build - fails if anything is wrong
|
|
check:
|
|
@echo "==> Checking formatting..."
|
|
@test -z "$$(gofmt -l .)" || (echo "Files not formatted:" && gofmt -l . && exit 1)
|
|
@echo "==> Running linter..."
|
|
golangci-lint run --config .golangci.yml ./...
|
|
@echo "==> Running tests..."
|
|
go test -v -race -timeout 30s ./...
|
|
@echo "==> Building..."
|
|
go build -ldflags "$(LDFLAGS)" -o /dev/null ./cmd/dnswatcher
|
|
@echo "==> All checks passed!"
|
|
|
|
clean:
|
|
rm -rf bin/
|
|
|
|
hooks:
|
|
@echo '#!/bin/sh' > .git/hooks/pre-commit
|
|
@echo 'make check' >> .git/hooks/pre-commit
|
|
@chmod +x .git/hooks/pre-commit
|
|
@echo "Pre-commit hook installed."
|
|
|
|
docker:
|
|
docker build .
|