~/talk

Working with Errors

Talkat GopherCon 2020 · 2020-11-09..11-13· [go, software-architecture]
slides:none on file

Go 1.13 adds three new functions in the errors package and the %w verb for fmt, and shows how wrapping preserves an underlying error so programs can use errors.Is and errors.As instead of brittle string checks; it demonstrates unwrap, %w usage, and the pointer-to-error pattern for type matches. It warns that wrapping becomes part of an API (so wrapping sentinel values like io.EOF is wrong), explains why no automatic stack traces or complex printf formatting made the stdlib, and describes a working defer+wrap pattern used at package.go.dev to add controlled traces.

AI-written summary · about

  1. 0:00Intro
  2. 0:20Wrapping and the error chain
  3. 0:44Error-wrapping support in Go 1.13
  4. 1:11Two audiences for errors
  5. 1:59A Config struct
  6. 2:19User-facing function
  7. 2:32Deciding with errors before 1.13
  8. 3:12Annotating errors
  9. 3:45Error wrapping
  10. 3:57Wrapping errors in Go 1.13
  11. 4:35Use errors. As instead of type assertions
  12. 5:00Under the hood
  13. 7:34Moving to Wrapped Errors
  14. 8:10Wrapping Returned Errors
  15. 9:41Did we go too far?
  16. 10:25Errors and Codes
  17. 11:22Stack trace example
  18. 11:49Stack trace problems
  19. 12:51We tried...
  20. 14:05How we don't do it
  21. 15:07Execution Traces With Wrap
  22. 15:17Standard Formatting
  23. 15:53Detailed Formatting
  24. 16:09Formatting Removed
  25. 16:26Detail Formatting with fmt. Formatter
  26. 17:40References
~/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.