~/talk

How Should We Access Global Resources?

Talkat GopherCon 2022 · 2022-09-26..09-28· [go, software-architecture]
slides:none on file

Argues for replacing globals with an interface-backed context that declares only required parts of a server, implemented in Go so missing dependencies fail at compile time. Provides working GitHub code and a homegrown statically-typed context plus a linter enforces minimal interface to prevent over-declaration. Uses standard Go interfaces and context types, lets functions receive one combined context, enables easy mocking for tests, supports concurrent requests, and reports compile-time breaks when a callee adds a new resource.

AI-written summary · about

  1. 0:00Introduction
  2. 1:15Why use Global variables
  3. 2:14Server objects
  4. 3:20Context
  5. 3:40Interfaces
  6. 5:17Dependencies
  7. 5:28One step simpler
  8. 6:12Conclusion
~/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.