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
|
// parse links
|
||||||
title, links := parseLinks(text) // TODO remove error from parseLinks, not needed
|
title, links := parseLinks(text)
|
||||||
if err != nil {
|
|
||||||
item.linkType = tBroken
|
|
||||||
rchan <- item
|
|
||||||
return
|
|
||||||
}
|
|
||||||
item.title = title
|
item.title = title
|
||||||
|
|
||||||
// walk links and add them as children to the current item
|
// walk links and add them as children to the current item
|
||||||
|
|||||||
@@ -74,11 +74,13 @@ func fetchPage(item *httpItem) (string, error) {
|
|||||||
// GET the url
|
// GET the url
|
||||||
resp, err := http.Get(item.url.String())
|
resp, err := http.Get(item.url.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// NOTE http.Head was already successful, this is highly likely to succeed
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// check response code
|
// check response code
|
||||||
if resp.StatusCode != http.StatusOK {
|
if resp.StatusCode != http.StatusOK {
|
||||||
|
// NOTE we already got StatusOK for http.Head, this is highly likely to succeed
|
||||||
return "", errFetchError
|
return "", errFetchError
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user