reviewed coverage report. remove some dead code. add a few comments to areas of code unlikely to hit.
This commit is contained in:
1 parent
42a40be62f
commit
4e335cfc8a
2 files changed
+3
-6
No files matched your search
@@ -102,12 +102,7 @@ func crawlItem(item *httpItem, rchan chan<- *httpItem) {
|
||||
}
|
||||
|
||||
// parse links
|
||||
title, links := parseLinks(text) // TODO remove error from parseLinks, not needed
|
||||
if err != nil {
|
||||
item.linkType = tBroken
|
||||
rchan <- item
|
||||
return
|
||||
}
|
||||
title, links := parseLinks(text)
|
||||
item.title = title
|
||||
|
||||
// walk links and add them as children to the current item
|
||||
|
||||
@@ -74,11 +74,13 @@ func fetchPage(item *httpItem) (string, error) {
|
||||
// GET the url
|
||||
resp, err := http.Get(item.url.String())
|
||||
if err != nil {
|
||||
// NOTE http.Head was already successful, this is highly likely to succeed
|
||||
return "", err
|
||||
}
|
||||
|
||||
// check response code
|
||||
if resp.StatusCode != http.StatusOK {
|
||||
// NOTE we already got StatusOK for http.Head, this is highly likely to succeed
|
||||
return "", errFetchError
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user