FAQ
Hi all

I have created the below "worker group" for goroutines through a channel
from various sources. If you run the task, you will see that it is always
worker group 4 that processes the job, what am I missing here so that all
workers process the channel? Or is there a better way?

https://play.golang.org/p/iPBlz25WmT

Thanks

--
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, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Naoki INADA at Jan 4, 2015 at 9:02 am
    Variable i changed outer function. Pass i as function argument.

    https://play.golang.org/p/ZlF4-NP81y

    It's very common pitfall for closure.
    It is not only for Go. Python, Ruby and many other languages supporting
    closure have same pitfall.
    On Sunday, January 4, 2015 5:55:24 PM UTC+9, ashleydw wrote:

    Hi all

    I have created the below "worker group" for goroutines through a channel
    from various sources. If you run the task, you will see that it is always
    worker group 4 that processes the job, what am I missing here so that all
    workers process the channel? Or is there a better way?

    https://play.golang.org/p/iPBlz25WmT

    Thanks
    --
    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, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Hello @ Thinkle at Jan 4, 2015 at 9:06 am
    Perfect, thanks!
    On 4 January 2015 at 10:02, Naoki INADA wrote:

    Variable i changed outer function. Pass i as function argument.

    https://play.golang.org/p/ZlF4-NP81y

    It's very common pitfall for closure.
    It is not only for Go. Python, Ruby and many other languages supporting
    closure have same pitfall.
    On Sunday, January 4, 2015 5:55:24 PM UTC+9, ashleydw wrote:

    Hi all

    I have created the below "worker group" for goroutines through a channel
    from various sources. If you run the task, you will see that it is always
    worker group 4 that processes the job, what am I missing here so that all
    workers process the channel? Or is there a better way?

    https://play.golang.org/p/iPBlz25WmT

    Thanks
    --
    You received this message because you are subscribed to a topic in the
    Google Groups "golang-nuts" group.
    To unsubscribe from this topic, visit
    https://groups.google.com/d/topic/golang-nuts/C17lNNDPpUM/unsubscribe.
    To unsubscribe from this group and all its topics, send an email to
    golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
    --
    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, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedJan 4, '15 at 8:55a
activeJan 4, '15 at 9:06a
posts3
users2
websitegolang.org

2 users in discussion

Hello @ Thinkle: 2 posts Naoki INADA: 1 post

People

Translate

site design / logo © 2022 Grokbase