~/talk

Becoming the Metaprogrammer Real World Code Generation

Talkat GopherCon 2021 · 2021-12-05..12-08· [developer-experience]
slides:none on file

Code generation cuts boilerplate by producing real, typed code: tools like sqlc and mockgen are used at ngrok to replace repetitive DB scanning and handwritten test mocks, and JSON marshalling generators (ffjson-style) speed serialization by avoiding reflection. A YAML-driven error compiler generates type-safe error functions and exportable error codes for multiple languages and it works in practice. Best practices include go generate, adding a “do not edit” header, isolating generated files, and preferring simple string templates plus a final gofumpt step.

AI-written summary · about

  1. 0:00Introduction
  2. 1:13What is Code Generation
  3. 4:05Why Code Generation
  4. 5:15stringer
  5. 7:18mockgen
  6. 12:59C Preprocessor
  7. 14:31ProtoC
  8. 16:54GoTest
  9. 19:39Browser Code Generation
  10. 21:49Typescript
  11. 22:29Code Generation
  12. 25:26Userfacing Errors
  13. 32:56Best Practices
  14. 41:07Recap
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 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
?
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.