gocolly / colly

Elegant Scraper and Crawler Framework for Golang
https://go-colly.org/
Apache License 2.0
23.2k stars 1.76k forks source link

Can not use colly/debug #626

Open netandreus opened 3 years ago

netandreus commented 3 years ago

When I try to use colly/debug this error is occured:

Cannot use '&debug.LogDebugger{}' (type *LogDebugger) as the type debug.Debugger Type
does not implement 'debug.Debugger' need the method: Event(e *Event) have the method: Event(e *Event)

My source code

package bootstrap

import (
    "github.com/gocolly/colly/v2"
    "github.com/gocolly/colly/debug"
)

// BuildColly /* *colly.Collector
func BuildColly() (*colly.Collector, error) {
    coll := colly.NewCollector(
        // Attach a debugger to the collector
        colly.Debugger(&debug.LogDebugger{}),
        colly.MaxDepth(1),
        colly.Async(true),
        )
    return coll, nil
}

Screenshot

Screenshot 2021-06-24 at 13 51 15
rubenwap commented 3 years ago

I think this is because you are not importing the v2 of debug, so to speak:

import (
    "github.com/gocolly/colly/v2"
    "github.com/gocolly/colly/v2/debug"
)

I am not getting that error doing that