Wrapping Errors with Defer

I wanted to document a small pattern I use to avoid repetition in error handling in Go while still providing context as an error climbs up the call stack. I first became aware of this pattern back in 2018 while the Go team was discussing error handling proposals . I&rsquo;m not exactly sure who first had this idea; the earliest example of it I can find is in a comment on a gist , but I&rsquo;m…