Skip to content

Possible modification to Goal #1 Example #147

@juroberttyb

Description

@juroberttyb

Just wondering, for Goal #1 in Readme, the 2nd approach seems to remove the required modification in startTheThing which receives conc.WaitGroup as function parameter, would that make it look simpler for adopting conc lib?

I misunderstood it on the first glance.

  • 1st (original one)
func main() {
    var wg conc.WaitGroup
    defer wg.Wait()

    startTheThing(&wg)
}

func startTheThing(wg *conc.WaitGroup) {
    wg.Go(func() { ... })
}
  • 2nd
func main() {
    var wg conc.WaitGroup
    defer wg.Wait()

    func(wg *conc.WaitGroup) {
        wg.Go(startTheThing(...))
    }(&wg)
}

func startTheThing() {
    ...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions