<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Goroutines on iMil.net</title>
    <link>http://imil.net/blog/tags/goroutines/</link>
    <description>Recent content in Goroutines on iMil.net</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 27 Nov 2019 11:17:40 +0000</lastBuildDate>
    <atom:link href="http://imil.net/blog/tags/goroutines/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Understanding golang channel range... again</title>
      <link>http://imil.net/blog/posts/2019/understanding-golang-channel-range-again/</link>
      <pubDate>Wed, 27 Nov 2019 11:17:40 +0000</pubDate>
      <guid>http://imil.net/blog/posts/2019/understanding-golang-channel-range-again/</guid>
      <description>&lt;p&gt;In a &lt;a href=&#34;https://imil.net/blog/2018/12/31/Understanding-golang-channel-range/&#34;&gt;previous article&lt;/a&gt;, I tried to explain my understanding of go &lt;em&gt;channels&lt;/em&gt; interaction with &lt;em&gt;ranges&lt;/em&gt;. Turns out my explanation was probably not clear enough because here I am, nearly a year after, struggling to achieve pretty much the same exercise.&lt;/p&gt;&#xA;&lt;p&gt;So here we go again, on a good old trial and error fashion progress.&lt;/p&gt;&#xA;&lt;p&gt;The goal here is to retrieve &lt;em&gt;channel&lt;/em&gt; messages that are pushed from go routines created in a &lt;em&gt;for&lt;/em&gt; loop.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Understanding golang channel range</title>
      <link>http://imil.net/blog/posts/2018/understanding-golang-channel-range/</link>
      <pubDate>Mon, 31 Dec 2018 17:06:42 +0000</pubDate>
      <guid>http://imil.net/blog/posts/2018/understanding-golang-channel-range/</guid>
      <description>&lt;p&gt;Here we go again with my &lt;a href=&#34;https://golang.org&#34;&gt;golang&lt;/a&gt; self teaching, today with a topic I had hard time understanding correctly (and hope I actually did): &lt;code&gt;range over channels&lt;/code&gt; along with &lt;code&gt;goroutines&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;First of all, let&amp;rsquo;s have a little reminder. We all know a &lt;code&gt;goroutine&lt;/code&gt; live its own life and must be waited for at the &lt;code&gt;main level&lt;/code&gt;, i.e. in this example:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;package&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#f92672&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt; &lt;span style=&#34;color:#a6e22e&#34;&gt;main&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&lt;span style=&#34;color:#66d9ef&#34;&gt;go&lt;/span&gt; &lt;span style=&#34;color:#66d9ef&#34;&gt;func&lt;/span&gt;() {&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;&#x9;&lt;span style=&#34;color:#a6e22e&#34;&gt;fmt&lt;/span&gt;.&lt;span style=&#34;color:#a6e22e&#34;&gt;Println&lt;/span&gt;(&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;hello there&amp;#34;&lt;/span&gt;)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#x9;}()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;}&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&#34;https://play.golang.org/p/cbczlMV4_0p&#34;&gt;run me on playground&lt;/a&gt;&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
