~/talk

Go Sync or Go Home

Talkat GopherCon Europe 2023 · 2023-06-26..06-29· [concurrency, go]
slides:none on file

Walks through concrete uses of the standard sync and x/sync packages and shows working code: a file-transfer function that uses errgroup.WithContext to propagate the first error, cancel remaining sends and limit goroutines; and a cached token authenticator that uses singleflight.Do/DoChan to suppress duplicate auth calls, reduce network and cache churn. Errgroup is imported by about 12,000 packages, singleflight by ~1,215. Also covers Pool, RWMutex, WaitGroup, sync.Map, Cond (discouraged) and singleflight Forget and generics wrappers.

AI-written summary · about

  1. 0:00Concurrency in Go
  2. 2:58Synchronization tools
  3. 5:23Using WaitGroup
  4. 6:45Error groups
  5. 8:25Context and limits
  6. 10:36Singleflight basics
  7. 13:37Caching with singleflight
  8. 17:40Singleflight Do method
  9. 20:30Singleflight DoChan
  10. 23:00Sync.Cond and alternatives
  11. 25:48Finding Go packages
~/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.