3 ms·
Cool, that's a good refactoring. What if we don't care about the errors and just want to return nil or the value. The caveat is that when any of your http requ
by codygman 12y ago
Cool, that's a good refactoring.
What if we don't care about the errors and just want to return nil or the value. The caveat is that when any of your http requests get a non 200 response code no further processing is done and nil is returned.
- Zikes 12y agoWhat I would do in that case is modify checkUrl to return a bool, change the return to return response.StatusCode == 200, and change the for loop contents to if !checkUrl(url){ fmt.Printf("Non-200 response for %s", url) break }