Code Generation to Survive
summary
Generates concrete Go decorators from real interfaces: gorap parses packages, finds an interface and emits wrappers for retries, fallbacks, round‑robin pools, circuit breakers, OpenTracing spans and Prometheus metrics. Templates live as versioned links or copied into the repo for reproducible builds; generated files include a go generate comment so regeneration is a single command. Used in production at Juno to avoid hand‑writing identical glue and the generated code works for many services with fewer bugs.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:17Code generation basics
- 4:34Problem with unique interfaces
- 7:05Need for reusable decorators
- 12:51Introducing go-wrap
- 17:21Available templates
- 23:32Benefits of code generation
- 24:14Q&A: Retry templates
- 25:20Q&A: Testing templates
- 26:31Q&A: Dead code concerns
- 27:53Q&A: Web interface idea
- 28:58Q&A: Manual edits in generated code
- 31:07Q&A: Combining decorators
- 32:12Q&A: Code generation in CI
- 34:48Q&A summary and closing
related talks
36mGenerating code in Go
30mWrite Less (Code), Generate More
16mTools for working with Go Code
42mBecoming the Metaprogrammer Real World Code Generation
59mUnleashing the Go Toolchain
51mGenerate You Some Code for Great Good
27mInception: Go programs that generate Go code
51mCode generation tips you didn't ask for
