From 06fbb2c40795b78dbfa0a9380e7ae98d453c3d71 Mon Sep 17 00:00:00 2001 From: Adam Tauber Date: Wed, 22 Aug 2018 18:53:13 +0200 Subject: [PATCH] [fix] golint --- colly.go | 2 +- colly_test.go | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/colly.go b/colly.go index c610aecaf..46080b53d 100644 --- a/colly.go +++ b/colly.go @@ -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, diff --git a/colly_test.go b/colly_test.go index db116cbc3..0fde6e73f 100644 --- a/colly_test.go +++ b/colly_test.go @@ -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)