Rodin
65cae45f13
docs: add patterns extracted from golang/go source
...
Using codebase-analysis skill (patterns mode) on the language source.
Real examples from the repo, not invented. Each pattern has:
- Rule, Example, Why, When NOT to use, Source file.
Topics: interface design, error handling, testing, package org,
concurrency, documentation, naming, smells.
2026-04-30 13:26:29 -07:00
aweiker
eb9171368b
docs: add 'when to use' triggers + examples to all patterns
...
Added 'When to Use' subsections with concrete decision triggers and
before/after Go code examples to patterns across all directories:
- patterns/error-handling.md (3 patterns: sentinels, wrapping, Join)
- patterns/concurrency.md (4 patterns: Mutex, Once, done channels, pipelines)
- patterns/interfaces.md (4 patterns: small interfaces, accept/return, adapter, optional)
- patterns/structs.md (3 patterns: zero-value, constructors, config structs)
- patterns/package-design.md (3 patterns: internal/, init(), context keys)
- patterns/style.md (3 patterns: interface checks, iota constants, named types)
- patterns/testing-advanced.md (3 patterns: table tests, golden files, httptest)
- patterns/api-conventions.md (3 patterns: Must, layered API, graceful shutdown)
- patterns/documentation.md (2 patterns: examples, deprecated)
- kubernetes/patterns.md (3 patterns: controller, workqueue, leader election)
- kubernetes/production-go.md (2 patterns: codegen, HandleCrash)
- smells/anti-patterns.md (2 anti-patterns: cache mutation, edge-triggered)
2026-04-30 12:08:41 +00:00
Rodin
0f1d7e4c06
feat: initial Go patterns guide from stdlib + Kubernetes source study
...
9 pattern files covering stdlib (structs, interfaces, API conventions, docs, style),
Kubernetes (controller/reconciler, informer/cache, leader election, code generation),
comparison (stdlib vs K8s approaches), and anti-patterns.
All patterns cite exact source files and line numbers.
2026-04-30 06:34:02 +00:00