~/talk

Inception, Go programs that generate Go code

Talkat GoLab 2017 · 2017-01-20..01-21· [go]
links:none on file
slides:none on file

Shows concrete techniques: use go/types (not just go/ast) to resolve embedded interfaces so mocks really implement everything, drive generators with go generate, and replace hand-written plumbing like testify assertions with a 240-line generator. Reports mapstructure cost 61 allocations; switching to generated marshal code removes those allocations and drops a 9.5µs operation down to ~117ns. Mentions mockery, gofmt/goimports, templates, and tests generated to keep code in sync.

AI-written summary · about

  1. 0:00Introduction to code generation
  2. 2:18Generating Go code from structured data
  3. 5:55Modifying existing Go code
  4. 8:21Parsing Go code to generate Go code
  5. 13:44Using go generate for automation
  6. 17:20Managing generated code and templates
  7. 21:57Generating boilerplate in testify
  8. 25:10Generating convenience wrappers
  9. 28:44Performance with mapstructure
  10. 31:59Generating tests for generated code
  11. 32:43Domain-specific languages in Go
  12. 35:11Summary and closing
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.