tag:blogger.com,1999:blog-8110657754519829885.post1162139519303847938..comments2023-07-10T01:54:55.230-07:00Comments on GoLang Tutorials: Channels in GoSathish VJhttp://www.blogger.com/profile/15718521031646368740noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-8110657754519829885.post-55279735304537725912016-10-25T03:42:52.283-07:002016-10-25T03:42:52.283-07:00Thanks for this tutorial. Really helpful.
For thos...Thanks for this tutorial. Really helpful.<br />For those who care to understand more try to reverse the order of go routines in both examples i.e. do:<br /> go receiveCakeAndPack(cs)<br /> go makeCakeAndSend(cs)<br />see what happenes. <br />try to delete 'go' and call them like normal functions and see what happens. Happy go'ing<br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-55533000786313105342016-10-21T19:58:54.364-07:002016-10-21T19:58:54.364-07:00Tutorials in your website are really great. I love...Tutorials in your website are really great. I love them. <br /><a href="http://www.reviewprotocol.com/tubeloom-review/" rel="nofollow">Find out More</a><br />Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-36962990931754647612016-10-17T19:57:56.891-07:002016-10-17T19:57:56.891-07:00Your tutorials are top quality. I am greatly impre...Your tutorials are top quality. I am greatly impressed with this quality tutorial. <a href="http://www.reviewshut.com/numerologist/" rel="nofollow">Mike Madigan's Numerologist</a>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-80757791682326803332016-10-16T20:32:20.389-07:002016-10-16T20:32:20.389-07:00I have some questions about your post. Can I post ...I have some questions about your post. Can I post here67 Steps By Tai Lopezhttp://www.reviewshut.com/the-67-steps/noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-27015393907894875052016-08-29T01:04:36.007-07:002016-08-29T01:04:36.007-07:00This is great info and I learn much from it. This is great info and I learn much from it. HeartBurn No More reviewshttp://www.reviewshut.com/heartburn-no-more-review/noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-35291988848849286732016-03-02T12:38:38.997-08:002016-03-02T12:38:38.997-08:00This tutorial is excellent! Your example is very c...This tutorial is excellent! Your example is very clear and I like the analogy of conveyor belt to explain the concept. Also, the way I understand gochannel is that it is like a async queue.Anonymoushttps://www.blogger.com/profile/14975296386654560156noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-85684408391768249712016-01-19T19:33:21.235-08:002016-01-19T19:33:21.235-08:00As far as waiting for process completion, a sync.W...As far as waiting for process completion, a sync.WaitGroup is a very effective method. <br />This allows us to wait on the tasks to complete explicitly instead of an arbitrary amount of time that will either be too long or too short in relation to the time it takes the tasks to complete. <br /><br />Code-ish:<br />wg := sync.WaitGroup<br /><br />func main () {<br />wg.Add(2) //Tells our WaitGroupAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-25976901320775660402014-09-05T09:42:46.971-07:002014-09-05T09:42:46.971-07:00After quick search: https://groups.google.com/foru...After quick search: https://groups.google.com/forum/#!topic/golang-nuts/hjioKxSJ3Tc<br /><br />So it looks like examples (make(chan <- int)) from the tutorial doesn't make practical sense, because nobody can read it eventually. Anyway, it would be probably good to explain it in the tutorial... test testhttps://www.blogger.com/profile/15781024292301530564noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-37920631896683691422014-09-05T09:36:21.921-07:002014-09-05T09:36:21.921-07:00+1
The tutorial is not complete, because author do...+1<br />The tutorial is not complete, because author doesn't explain the use case how such channels gonna be used. I am also curious how it should be used, but the article doesn't answer the question :(test testhttps://www.blogger.com/profile/15781024292301530564noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-88485032769108640802014-08-20T09:05:40.378-07:002014-08-20T09:05:40.378-07:00Not sure I got the channel direction: if the chann...Not sure I got the channel direction: if the channel only recieves produced data (how can anyone consume it? If no one can consume it what is it good for?)<br />Maybe it can be used as a pointer to a bidirectional chan for consumer only or producer only, I'll be glad to understand the use case for such channel.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-11027011370245430402013-10-31T15:39:45.827-07:002013-10-31T15:39:45.827-07:00Could you post a full working code? Please.Could you post a full working code? Please.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-67636583487751159452013-10-06T12:08:23.157-07:002013-10-06T12:08:23.157-07:00on http://golang.org/ref/spec#Channel_types
chan&l...on http://golang.org/ref/spec#Channel_types<br />chan<- float64 // can only be used to send float64s<br /><-chan int // can only be used to receive ints<br />your channel directions:<br />ic_send_only := make (<-chan int) //a channel that can only send data - arrow going out is sending<br />ic_recv_only := make (chan<- int) //a channel that can only receive a data - arrow going Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-27084573770109016262013-02-21T03:23:18.798-08:002013-02-21T03:23:18.798-08:00impressed to view, i am visiting on first time to ...impressed to view, i am visiting on first time to the blog, and i am really like it and i find it very helpful, hope that you will keep it up..<br /><a href="http://www.channel.pk/live-entertainment-tv/" rel="nofollow">Entertainment Live</a>Wafa Ahmadhttps://www.blogger.com/profile/00622628523719249556noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-53596254877889649582012-12-04T06:55:12.866-08:002012-12-04T06:55:12.866-08:00Excellent post. Regarding the last sentence:
>...Excellent post. Regarding the last sentence:<br /><br />> So do remember to be careful about analyzing code with printed logs when dealing with goroutines and channels.<br /><br />What would be the proper way to analyze/debug code that deals with goroutines and channels then?<br /><br />Thanks.Anonymoushttps://www.blogger.com/profile/16044528956758497529noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-80374013483434596832012-08-22T01:08:59.042-07:002012-08-22T01:08:59.042-07:00The first and unique post so far which has really ...The first and unique post so far which has really helped me understand how channels work in Go. At least in their basics.<br /><br />Thanks a lot.Davicerohttps://www.blogger.com/profile/15362389852773597276noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-17765775403629499862012-06-16T04:32:51.521-07:002012-06-16T04:32:51.521-07:00Is there any way in which a channel can have one s...Is there any way in which a channel can have one sender and multiple receivers?Anirbanhttps://www.blogger.com/profile/00285530012534090130noreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-71423224927129089822012-03-31T08:45:46.480-07:002012-03-31T08:45:46.480-07:00// how about this
func receiveCakeAndPack(cs chan...// how about this<br /><br />func receiveCakeAndPack(cs chan string) {<br /> for {<br /> select {<br /> case s := <-cs: // get whatever cake is on the channel<br /> fmt.Println("Packing received cake:", s)<br /><br /> default:<br /> if doneMaking {<br /> print("pack: all done\n")<br />Walterhttp://www.heiho.netnoreply@blogger.comtag:blogger.com,1999:blog-8110657754519829885.post-48687983729819132072011-11-02T16:11:14.017-07:002011-11-02T16:11:14.017-07:00package main
import (
"fmt"
&qu...package main<br /><br />import (<br /> "fmt"<br /> "strconv"<br />)<br /><br />func makeCakeAndSend(cs chan string) {<br /> for i := 1; i<=3; i++ {<br /> cakeName := "Strawberry Cake " + strconv.Itoa(i)<br /> fmt.Println("Making a cake and sending ...", cakeName)<br /> cs <- cakeName //send a strawberry cake<br /> }<brAnonymousnoreply@blogger.com