What is the default mode in GoColly, sync or async?


What is the default mode in which network requests are executed in GoColly? Since we have the Async method in the collector I would assume that the default mode is synchronous.
However, I see no particular difference when I execute these 8 requests in the program other than I need to use Wait for async mode. It seems as if the method only controls how the program is executed (the other code) and the requests are always asynchronous.

package main

import (


func main() {

    urls := []string{

    c := colly.NewCollector(

    c.OnHTML("title", func(e *colly.HTMLElement) {

    for _, url := range urls {




The default collection is synchronous.

The confusing bit is probably the collector option colly.Async() which ignores the actual param. In fact the implementation at the time of writing is:

func Async(a ...bool) CollectorOption {
    return func(c *Collector) {
        c.Async = true // uh-oh...!

Based on this issue, it was done this way for backwards compatibility, so that (I believe) you can pass an option with no param at it’ll still work, e.g.:

colly.NewCollector(colly.Async()) // no param, async collection

If you remove the async option altogether and instantiate with just colly.NewCollector(), the network requests will be clearly sequential — i.e. you can also remove c.Wait() and the program won’t exit right away.

Answered By – blackgreen

Answer Checked By – Katrina (GoLangFix Volunteer)

Leave a Reply

Your email address will not be published.