golang / tour

[mirror] A Tour of Go
BSD 3-Clause "New" or "Revised" License
1.53k stars 521 forks source link

tour: [REPLACE WITH SHORT DESCRIPTION] #1597

Closed mesas998 closed 2 months ago

mesas998 commented 4 months ago

Context: https://go.dev/tour/methods/19 I dispensed with the function wrapper in the interest of clarity: michael.sweeney303@gmail.com


package main

import ( "fmt" "time" )

type MyError struct { When time.Time What string } func run() MyError { return MyError{time.Now(),"it didn't work",} }

func main() { returned := run() fmt.Printf("run() returned a %T consisting of a %T and a %T",returned,returned.When,returned.What) }