Skip to content

Commit

Permalink
[fix] golint
Browse files Browse the repository at this point in the history
  • Loading branch information
asciimoo committed Aug 22, 2018
1 parent d4e95b5 commit 06fbb2c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion colly.go
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ func (c *Collector) handleOnHTML(resp *Response) error {
doc.Find(cc.Selector).Each(func(_ int, s *goquery.Selection) {
for _, n := range s.Nodes {
e := NewHTMLElementFromSelectionNode(resp, s, n, i)
i += 1
i++
if c.debugger != nil {
c.debugger.Event(createEvent("html", resp.Request.ID, c.ID, map[string]string{
"selector": cc.Selector,
Expand Down
6 changes: 4 additions & 2 deletions colly_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,9 +639,11 @@ func TestHTMLElement(t *testing.T) {
t.Fatal(err)
}
elements := []*HTMLElement{}
doc.Find(sel).Each(func(i int, s *goquery.Selection) {
i := 0
doc.Find(sel).Each(func(_ int, s *goquery.Selection) {
for _, n := range s.Nodes {
elements = append(elements, NewHTMLElementFromSelectionNode(resp, s, n))
elements = append(elements, NewHTMLElementFromSelectionNode(resp, s, n, i))
i++
}
})
elementsLen := len(elements)
Expand Down

0 comments on commit 06fbb2c

Please sign in to comment.