awesome-patterns/concurrency/iterator_error_handling/main.go
jian.han d1e5d3f1c1 added a new iterator with error handling
Just finish the first pharse
2018-01-24 16:24:53 +10:00

28 lines
364 B
Go

package main
import (
"time"
"github.com/davecgh/go-spew/spew"
)
type FetchResult struct {
Domain string
StatusCode uint
Header string
}
func dummyFetchUrl(url string) *FetchResult {
time.Sleep(time.Second * 1)
return &FetchResult{
url,
200,
"Dummy Header",
}
}
func main() {
r := dummyFetchUrl("http://www.google.com")
spew.Dump(r)
}