Did you check the errors package: https://godoc.org/github.com/pkg/errors ?
It offers a great way to wrap chained errors. Sander On 4 Feb 2017, at 09:08, so.qu...@gmail.com wrote: Is there a idiomatic recommendation for generally displaying errors resulting from chained methods? The following would print out "ERROR: Foo() ERROR: Bar() ERROR: stdlib.Func() something went wrong with this standard function call", which feels obviously wrong. func main() { if err := Foo(); err != nil { fmt.Printf("ERROR: Foo() %s", err) os.Exit(1) } } func Foo() error { if err := Bar(); err { return fmt.Errorf("ERROR: Bar() %s", err) } return nil } func Bar() error { if err := stdlib.Func(); err != nil { return fmt.Errorf("ERROR: stdlib.Func() %s", err) } return nil } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.