I think you may be confused about fmt and error unwrapping. 

The fmt.Println() in your example code does *not *unwrap err1. When 
fmt.Errorf creates the error, the message  is hard coded "fmt wrapping: 
error". The Println is just printing the result of err1.Error()


On Wednesday, September 2, 2020 at 12:04:29 PM UTC-4, simon place wrote:
>
> the example compares the print output of a fmt.errorf wrapped error and a 
> custom-error type wrapped error, the custom one isn't showing the wrapped 
> error.,
>
> On Wednesday, 2 September 2020 16:58:31 UTC+1, burak serdar wrote:
>>
>> On Wed, Sep 2, 2020 at 9:48 AM 'simon place' via golang-nuts 
>> <golan...@googlegroups.com> wrote: 
>> > 
>> > import "github.com/pkg/errors" 
>> > 
>> > should be 
>> > 
>> > import "errors" 
>> > 
>> > left over from testing, but makes no difference, as expected. 
>>
>> What were you expecting? 
>>
>> > 
>> > -- 
>> > 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 golan...@googlegroups.com. 
>> > To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/0d654a7b-dc92-432b-b152-91bd6ba68cf2o%40googlegroups.com.
>>  
>>
>>
>

-- 
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/25dc264d-0f90-40c8-bc12-6987865bf972o%40googlegroups.com.

Reply via email to