diff --git a/search.go b/search.go index 9cb1252..d87d8c8 100644 --- a/search.go +++ b/search.go @@ -31,9 +31,15 @@ func Google(query string) (results []Result) { go func(){c <- Image(query)}() go func(){c <- Video(query)}() + timeout := time.After(80 * time.Millisecond) for i :=0; i < 3; i++ { - result := <-c - results = append(results, result) + select{ + case result := <- c: + results = append(results, result) + case <- timeout: + fmt.Println("timed out!!") + return + } } return }