~/talk

Refactor Cloud applications in Go 1.18 with generics

Talkat Google I/O 2022 · 2022-05-11..05-12· [go]
name:Cody Oss
speakerdeck:codyoss
slides:none on file

Go 1.18 adds generics, type sets and constraints so code can be parameterized for functions, structs and methods; the demo refactors genny-generated functions into a single generic Max and a generic HTTP middleware, removes a dependency on genny and reduces codebase by over 40%. It uses golang/x/exp constraints (and the experimental constraints package) to bound numeric types, compiles with type inference, and Cloud Run deploys successfully after refactor.

AI-written summary · about

  1. 0:00Introduction to Go generics
  2. 2:39Understanding type sets
  3. 6:32Generics vs. other languages
  4. 7:55When to use generics
  5. 9:19When to avoid generics
  6. 10:57Refactoring a web app
  7. 22:53Conclusion and recap
~/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.