On Wednesday, September 2, 2020 at 2:19:31 PM UTC-4, simon place wrote:
> * fmt.Printf(%w) is just to add more text to an error, because errors are > immutable its needed.(unless you have custom error types and are local to > them, then you could just edit their state.) > There is more to fmt.Errorf(%w) than " just to add more text". Sure, it creates static error text that contains the wrapped error's text. But it also creates a true wrapped error. See https://play.golang.org/p/EH-XoZGneMj If you have not already, I suggest reading https://blog.golang.org/go1.13-errors > * custom wrapping types, unlike fmt.Printf(%w), create error 'classes' for > testing against and have utilities to help deal with unknown depths of > wrapping. > > since i was only dealing with one level, i probably should have avoided > wrapping entirely, but now i know! > > this does seem as if its a pattern that might come up elsewhere, so good > to understand clearly (unless i'm still off about something above). > > thanks for help. > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b871f948-aa8c-486d-85f0-9fa4d8bcf7d4o%40googlegroups.com.