~/talk

Writing Beautiful Packages in Go

Talkat Golang UK 2017 · 2017-08-16..08-18· [go]
name:Mat Ryer
github:matryer
slides:none on file

Advice for package design focuses on concrete choices: keep the exported API small and obvious, prefer single-method interfaces and use io.Writer over os.File so JSON marshaling works to buffers, files or HTTP responses, avoid implicit goroutines and let callers manage concurrency, make zero values useful instead of forcing constructors, accept an HTTP client and put context as the first arg, and run linters and formatters like metalinter & gofmt (example shown: a 93% go report card score).

AI-written summary · about

  1. 0:00Intro
  2. 0:39What are we gonna talk about today
  3. 0:58What is a package
  4. 1:51Beautiful packages
  5. 2:40Motivation
  6. 3:23Keep it internal
  7. 3:51Web 20 movement
  8. 4:36Usercentered design
  9. 5:07Whos using the package
  10. 5:42Market vendor
  11. 5:59Packages
  12. 6:40Narrow types
  13. 7:10Writers
  14. 7:58Single method interfaces
  15. 9:27HTTP handlers
  16. 10:10Structure
  17. 11:31Test Data
  18. 12:20Use Multiple Go Files
  19. 13:11Leave Concurrency to Users
  20. 14:44First User
  21. 15:04TestDriven Development
  22. 16:12Be Similar
  23. 17:05Write Some Jokes
  24. 17:55Naming
  25. 18:42API Footprint
  26. 21:29Default Formats
  27. 22:11Avoid constructors
  28. 23:36Dont automatically add interfaces
  29. 24:26Shrink API footprint
  30. 24:57Method names
  31. 25:51HTTP client
  32. 26:35Context
  33. 26:50Global State
  34. 28:05Test
  35. 29:14Package names
  36. 30:07Project mascots
  37. 30:53Name that project
  38. 33:57Go report card
  39. 34:55Quality package
  40. 36:30Questions
~/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.