~/talk

Idiomatic Go Tricks

Talkat Golang UK 2016 · on Thursday, 2016-08-18· [go]
name:Mat Ryer
github:matryer
slides:none on file

Shows concrete Go patterns and copyable snippets: uses line of sight code layout and consistent defer usage for deterministic cleanup, demonstrates teardown-as-return where setup returns a cleanup function to be deferred (useful in tests), provides a startTimer that captures time and returns a stop closure used with defer, implements optional validation via type assertions, uses single-method interfaces and HandlerFunc in place of structs, offers a retry helper (attempts < 5 example) and a semaphore built from a buffered channel to limit concurrency (example: five goroutines).

AI-written summary · about

  1. 0:00Intro
  2. 0:28About me
  3. 2:12Go code
  4. 5:33Bad line of sight
  5. 6:07Line of sight tips
  6. 8:23Function type alternatives for single method interfaces
  7. 9:14Log blocks
  8. 9:59Return teardown functions
  9. 11:30Good timing
  10. 12:37Discover interfaces
  11. 14:15Other ways to implement the interface
  12. 15:06Optional features
  13. 17:35Using simple mocks
  14. 21:11Retrying Delay between retries
  15. 22:08Empty struct implementations
  16. 23:33Semaphores
  17. 25:49Be obvious not clever
  18. 26:29How to become a native speaker
~/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.