Cannot understand this example

Hello, see this code in the golang tour
https://tour.golang.org/methods/19

How did the string in the return of the Error() method got printed although i did not call the Error() method ?

In line 27 err is printed and it is of type *main.MyError, so how did the
at 2021-02-15 20:40:58.856545102 +0300 +03 m=+0.000045210, it didn’t work
was printed and i did not call Error() method ?

When the fmt.Print* family of functions (fmt.Println, fmt.Sprintf, etc.) encounter an error argument, the default way they format it is by calling the error's Error function.

1 Like

Thank you i nearly understood it.