e030cd28e9
Builder (cli.For[C]): Root/Dir/Cmd/SlotDir/Slot construct the tree without repeating the [C] type parameter at every node; returns plain *Node[C] so it interoperates with struct-literal construction. App[C]: collapses the per-binary main.go — standard flags (-color/-json/-version, -server when configured), mode-aware color defaults, version banner, client connect, and the one-shot-vs-shell split — into one Main(). Transport-agnostic via a Connect callback, so it never assumes gRPC. Makefile: `make check` = fixstyle vet lint test (the pre-commit gate), plus build and a linux+openbsd cross target. The example now dogfoods both Builder and App. Tests cover the builder tree and App's one-shot dispatch / -version / nil-Connect paths. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
34 lines
969 B
Makefile
34 lines
969 B
Makefile
# SPDX-FileCopyrightText: (C) Copyright 2026 Pim van Pelt <pim@ipng.ch>
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
.PHONY: help all check test fixstyle vet lint build cross
|
|
|
|
help: ## Show this help
|
|
@printf "Usage: make <target>\n\nTargets:\n"
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
|
|
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
|
|
all: check ## Alias for check
|
|
|
|
check: fixstyle vet lint test ## Run the full pre-commit gate (format, vet, lint, test)
|
|
|
|
test: ## Run all Go unit tests
|
|
go test ./...
|
|
|
|
fixstyle: ## Format the Go tree (gofmt)
|
|
gofmt -w .
|
|
|
|
vet: ## Run go vet across the tree
|
|
go vet ./...
|
|
|
|
lint: ## Run golangci-lint across the Go tree
|
|
golangci-lint run ./...
|
|
|
|
build: ## Build all packages for the host platform
|
|
go build ./...
|
|
|
|
cross: ## Verify the tree builds on Linux and OpenBSD
|
|
GOOS=linux GOARCH=amd64 go build ./...
|
|
GOOS=linux GOARCH=arm64 go build ./...
|
|
GOOS=openbsd GOARCH=amd64 go build ./...
|