Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2017-11-02 Thread Henrik Johansson
And technically they are not tracking goroutines but done things. Each goroutine could each finish 10 things. On Thu, 2 Nov 2017, 17:01 Andy Balholm, wrote: > You can add goroutines to a WaitGroup as you create them. There is nothing > that keeps you from calling Add more than once. > > Andy > >

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2017-11-02 Thread Andy Balholm
You can add goroutines to a WaitGroup as you create them. There is nothing that keeps you from calling Add more than once. Andy > On Nov 1, 2017, at 11:10 PM, kanth...@gmail.com wrote: > > I am new to Go and I had read numerous times in various articles that one can > technically create any nu

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-30 Thread Michael Jones
Inspectre, Here is a slight modification that may suit your needs: https://play.golang.org/p/dppJOkPcvG Change summary: 1. Added a terse option (‘-t’) so I could see the urls and errors only. 2. Changed the URL queue to a channel so that… 3. …the main loop (lines 139–148) would be clea

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-30 Thread Chris Randles
When dealing with an unknown amount of input, I find https://godoc.org/go4.org/syncutil#Gate a useful alternative to sync.WaitGroup. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-30 Thread Nick Craig-Wood
I forgot to add - don't call `wg.Add(1)` inside the go routine - it is racy! If you are trying to start a pool of go routines, you can find that none of them get scheduled before you run the wg.Wait(). -- Nick Craig-Wood -- http://www.craig-wood.com/nick -- You received this message because yo

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-30 Thread Nick Craig-Wood
Here is some code I wrote which demonstrates a solution. This is a recursive concurrent directory lister which I think is an identical problem to yours - you start with one directory - you find new directories in the course of listing them which you also want to list, but you want to limit the con

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-29 Thread Ian Lance Taylor
On Wed, Jun 29, 2016 at 9:52 AM, Inspectre Gadget wrote: > Hey everyone, > > Here’s my issue, I will try to keep this short and concise: > > I have written a program that will accept a URL, spider that URL’s domain > and scheme (http/https), and return back all input fields found throughout > to t

[go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-29 Thread Inspectre Gadget
Hey everyone, Here’s my issue, I will try to keep this short and concise: I have written a program that will accept a URL, spider that URL’s domain and scheme (http/https), and return back all input fields found throughout to the console. The purpose is largely for web application security