I am trying to build my project but I am having this strange error... does anyone have an idea why this would happen?
go build ./cmd/my_crawler
# my_crawler/vendor/github.com/gocolly/colly
vendor/github.com/gocolly/colly/colly.go:972:4: undefined: htmlquery.FindEach
vendor/github.com/gocolly/colly/xmlelement.go:137:3: undefined: htmlquery.FindEach
vendor/github.com/gocolly/colly/xmlelement.go:161:3: undefined: htmlquery.FindEach
make: *** [build] Error 2
the following dependency DOES exist in my vendor directory...
vendor/github.com/antchfx/htmlquery/query.go
I think I found out why...
https://github.com/antchfx/htmlquery/commit/b8d36292614567671decfe6f96c7b8c432d3249b
From https://github.com/antchfx/htmlquery changelog:
2019-02-04
#7 Removed deprecated FindEach() and FindEachWithBreak() methods.
I added this to my Gopkg.toml :
[[constraint]]
name = "github.com/antchfx/htmlquery"
revision = "db5c1236cbb43c58add1164a8b20d844683e537f"
If I have some time I will make a pull request changing these calls...
seems to be fixed in c64a5846758a4620942e85daa6e8d969ea994d8f ! Thank you!
until there is a tagged release, this seems to be the way to go: (using go modules)
$ go get -u github.com/gocolly/colly@b3032e87d3efbd3c00423aeb84f1fb7772c7d8a6
Isn't it merged on the main branch?
It is fixed in 1.2.0.
Most helpful comment
until there is a tagged release, this seems to be the way to go:
(using go modules)