package adverr import ( "testing" ) var ( ErrDoStuffFailed = NewErrTmpl("ErrDoStuffFailed", "test error: %s") ) func TestErrTmpl(t *testing.T) { err := doTemplateStuff() Println(err) } func doTemplateStuff() error { return ErrDoStuffFailed.New("because of reasons") } func TestErrTmplChain(t *testing.T) { errors := make([]error, 0) errors = append(errors, doTemplateStuff()) errors = append(errors, doTemplateStuff()) errors = append(errors, doTemplateStuff()) Println(ErrDoStuffFailed.Chain("Neither of that stuff worked", errors)) }