Re: [go-nuts] Allocating memory to consume a variable from channel in select statement

2016-08-24 Thread Ian Lance Taylor
On Wed, Aug 24, 2016 at 2:49 AM, Chintan Sheth wrote: > I am using select statement to dispatch work coming from multiple > goroutines, the variables used to consume the channel are allocated manually > as I am recycling those > > > for { > a := getA() > b := getB() > select { > case a = <-cha

[go-nuts] Allocating memory to consume a variable from channel in select statement

2016-08-24 Thread Chintan Sheth
I am using select statement to dispatch work coming from multiple goroutines, the variables used to consume the channel are allocated manually as I am recycling those for { a := getA() b := getB() select { case a = <-chan1: go doSomething(&a) case b = <-chan2: go doSomething2(&b) } }