diff --git a/concurrency/subtasks/main.go b/concurrency/subtasks/main.go index ab8f7d2..3c03aca 100644 --- a/concurrency/subtasks/main.go +++ b/concurrency/subtasks/main.go @@ -1,8 +1,55 @@ package main -import "github.com/jianhan/go-patterns/concurrency/subtasks/fetchers" +import ( + "errors" + + "github.com/davecgh/go-spew/spew" +) + +type Person struct { + Name string +} + +type Dog struct { + Name string +} + +type House struct { + person *Person + dog *Dog +} func main() { // divide_and_conquer.RunDivideAndConquer() - fetchers.RunFetchers() + // fetchers.RunFetchers() + // h := &House{} + // spew.Dump(h) + + // go func() { + // defer fmt.Println("Returned") + // for { + // select { + // default: + // return + // } + // } + // fmt.Println("TEST") + // }() + // time.Sleep(time.Second) + // spew.Dump(caller()) + // spew.Dump(nakedReturn()) +} + +func nakedReturn() (i uint32, err error) { + return 12, errors.New("Test") +} + +func caller() (d *Dog, err error) { + p, err := produceErr() + spew.Dump(p) + return +} + +func produceErr() (*Person, error) { + return &Person{Name: "James"}, errors.New("New Error") }