Help with first concurrent execise

This page summarizes the projects mentioned and recommended in the original post on /r/golang

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • go-concurrency-exercises

    Hands on exercises with real-life examples to study and practice Go concurrency patterns. Test-cases are provided to verify your answers.

  • I have started to try to learn concurrency in Go. I have read this and now started to try to solve this one

  • go

    The Go programming language

  • As a help it recommends to check this rate limiter and also it said that the solution could be done in three lines.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • golang-docker

    Docker Official Image packaging for golang

  • // Crawl uses `fetcher` from the `mockfetcher.go` file to imitate a // real crawler. It crawls until the maximum depth has reached. func Crawl(url string, depth int, wg *sync.WaitGroup) { defer wg.Done() if depth <= 0 { return } body, urls, err := fetcher.Fetch(url) if err != nil { fmt.Println(err) return } fmt.Printf("found: %s %q\n", url, body) wg.Add(len(urls)) for _, u := range urls { // Do not remove the `go` keyword, as Crawl() must be // called concurrently go Crawl(u, depth-1, wg) } return } func main() { var wg sync.WaitGroup wg.Add(1) Crawl("http://golang.org/", 4, &wg) wg.Wait() }

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts