I am new to golang and I am not sure if it is a stupid question. I am 
reading the slides of Rob Pike on go concurrency patterns in 2012. I think 
there is a resource leak in the below function. As the function will return 
after the first send&receive pair happens on channel c, the other 
goroutines trying to send on channel c will be blocked and prevents 
resources GC. Anyone knows golang well can confirm this? If it is resource 
leak, how can I detect it using what kind of golang tooling?down vote
favorite 
<https://stackoverflow.com/questions/49648380/i-want-a-confirmation-from-some-golang-master-about-if-there-is-a-resource-leak#>

func First(query string, replicas ...Search) Result {
  c := make(chan Result)
  searchReplica := func(i int) {
    c <- replicas[i](query)
  }
  for i := range replicas {
    go searchReplica(i)
  }
  return <-c}

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to