...

Package xdefer

import "oss.terrastruct.com/util-go/xdefer"
Overview
Index

Overview ▾

Package xdefer implements an extremely useful function, Errorf, to annotate all errors returned from a function transparently.

func Errorf

func Errorf(err *error, s string, v ...interface{})

Errorf makes it easy to defer annotate an error for all return paths in a function. See the tests for how it's used.

Pass s == "" to only annotate the location of the return.