golang / tour

[mirror] A Tour of Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tour: [REPLACE WITH SHORT DESCRIPTION]

mesas998 opened this issue · comments

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)
}