main.go: Entry point that wires CLI.cmd/: Cobra commands (e.g.,inspect.go,generate.go). One file per verb/feature plus tests.pkg/: Reusable packages (pkg/cert,pkg/ui). Keep public APIs small and documented.internal/testutil: Test helpers not exported.testdata/: Sample certs/keys used by tests (generated by script).docs/: User and contributor docs; prefer updating when behavior changes.
make build: Compile binary to./cert.make run: Build then run locally.make test: Generate test certs and rungo test ./....make test-coverage: Run tests with coverage, writecoverage.out.make test-coverage-html: Producecoverage.htmlreport.make fmt/make vet: Format and static checks.make clean: Remove build/coverage artifacts.make build-all: Cross-compile into./dist/for major platforms.
- Go 1.20+. Follow standard Go conventions: exported names in
CamelCase, receivers concise (c *Cert), package names short, lower-case. - Tabs for Go files (size 4). YAML/JSON/MD use 2 spaces. LF line endings, trailing whitespace trimmed (see
.editorconfig). - Keep commands in
cmd/small; move logic topkg/. Prefer pure functions inpkg/certwith clear inputs/outputs.
- Framework:
go test. Tests live alongside code in*_test.gowithTestXxxfunctions. - Data:
testdata/is auto-prepared bymake testviatestdata/generate_test_certs.sh. - Coverage: aim for meaningful coverage of critical paths; verify with
make test-coverage.
- Use Conventional Commits:
feat:,fix:,docs:,refactor:, etc. - PRs: include purpose, approach, and user-facing impact. Link issues. Add before/after CLI examples or screenshots when output changes. Update
docs/as needed.
- Do not commit real private keys or secrets. Only use/generated fixtures in
testdata/. - Installer (
install.sh) may prompt for sudo; review diffs when changing install paths or permissions.