<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Go on Edward Muller</title>
    <link>https://icanhazdowntime.org/categories/go/</link>
    <description>Recent content in Go on Edward Muller</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Wed, 15 Apr 2026 17:59:44 -0700</lastBuildDate>
    <atom:link href="https://icanhazdowntime.org/categories/go/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>On Variable Declarations: Slices</title>
      <link>https://icanhazdowntime.org/posts/on-variables-declarations-slices/</link>
      <pubDate>Wed, 10 Feb 2016 19:00:00 +0000</pubDate>
      <guid>https://icanhazdowntime.org/posts/on-variables-declarations-slices/</guid>
      <description>&lt;p&gt;There are several different ways to declare &lt;a href=&#34;https://golang.org/doc/effective_go.html#slices&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;slices in Go&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;IMO, there is an implied meaning to each of these different ways:&lt;/p&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&lt;code&gt;var foo []T&lt;/code&gt; : Declare a slice that the code is going to start appending an unknown number of items to and/or the number doesn&amp;rsquo;t matter.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;var foo = []T{ ... }&lt;/code&gt; or &lt;code&gt;foo := []T{ ... }&lt;/code&gt; : Where &lt;code&gt;...&lt;/code&gt; is a list of items of type &lt;code&gt;T&lt;/code&gt;. Declare a slice where the code has already figured out how to fill it and it&amp;rsquo;s unlikely to change much or at all while I reference it. Prefer the later. Also seen as &lt;code&gt;return []T{ ... }&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;li&gt;&lt;code&gt;foo := make([]T, &amp;lt;len&amp;gt;, &amp;lt;cap&amp;gt;)&lt;/code&gt; : Declare a slice of a known capacity which I don&amp;rsquo;t expect to exceed while appending or it&amp;rsquo;s the minimum capacity slice that I&amp;rsquo;ll use. Generally the shorter form w/o capacity (ex. &lt;code&gt;make([]T, &amp;lt;len&amp;gt;)&lt;/code&gt;), should only be used when making a slice as the target of a copy or index range manipulation loop.&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&lt;p&gt;I feel that these above meanings lead to easier to understand and consume code. I encourage people to consider this when declaring and using1pa slices.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Type, *Type, Receivers &amp; Interfaces</title>
      <link>https://icanhazdowntime.org/posts/type-ptype-receiver-interfaces/</link>
      <pubDate>Wed, 14 Oct 2015 15:05:14 -0700</pubDate>
      <guid>https://icanhazdowntime.org/posts/type-ptype-receiver-interfaces/</guid>
      <description>&lt;p&gt;I&amp;rsquo;ve recently seen a bit of confusion around types, pointers to types, receivers for the two and interfaces. I&amp;rsquo;m going to try to clarify that confusion a bit with some examples.&lt;/p&gt;&#xA;&lt;p&gt;Given a simple interface named &lt;strong&gt;Fooer&lt;/strong&gt;, a struct type (&lt;strong&gt;Bar&lt;/strong&gt;) that implements it and a simple function (&lt;strong&gt;DoFoo()&lt;/strong&gt;) that accepts a &lt;strong&gt;Fooer&lt;/strong&gt; and calls the interface function like so:&lt;/p&gt;&#xA;&lt;iframe src=&#34;https://play.golang.org/p/QDpxG41xqK&#34; frameborder=&#34;0&#34; style=&#34;width: 100%; height: 30em&#34;&gt;&lt;/iframe&gt;&#xA;&lt;p&gt;When you run the code above you get &lt;code&gt;Fooer: 5&lt;/code&gt; for output.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Deploying Go Apps to Heroku with Docker</title>
      <link>https://icanhazdowntime.org/posts/deploying-go-heroku-docker/</link>
      <pubDate>Tue, 18 Aug 2015 10:11:50 -0700</pubDate>
      <guid>https://icanhazdowntime.org/posts/deploying-go-heroku-docker/</guid>
      <description>&lt;p&gt;This post covers using the &lt;a href=&#34;https://github.com/heroku/heroku-docker&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;heroku docker&lt;/code&gt;&lt;/a&gt; cli plugin to deploy a &lt;a href=&#34;https://golang.org&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Go&lt;/a&gt; application to &lt;a href=&#34;https://heroku.com&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Heroku&lt;/a&gt;. Only Linux and MAC OSX are supported until &lt;a href=&#34;https://docs.docker.com/compose/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;&lt;code&gt;docker-compose&lt;/code&gt;&lt;/a&gt; supports MS Windows.&lt;/p&gt;&#xA;&lt;h2 id=&#34;prerequisites&#34;&gt;&#xA;  Prerequisites&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#prerequisites&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.docker.com/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Docker&lt;/a&gt;: Installable via either the &lt;a href=&#34;http://docs.docker.com/mac/started/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;toolbox for MAC OSX&lt;/a&gt; or via the &lt;a href=&#34;http://docs.docker.com/linux/started/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Linux getting started guide&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://docs.docker.com/compose/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Docker Compose&lt;/a&gt;: Included in the Docker Toolbox. Linux instructions are &lt;a href=&#34;https://docs.docker.com/compose/install/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;here&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;Free &lt;a href=&#34;https://heroku.com&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Heroku&lt;/a&gt; Account&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://toolbelt.heroku.com/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Heroku Toolbelt&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/heroku/heroku-docker&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Heroku Docker CLI Plugin&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Please take a look at the links above and make sure everything is installed as per the linked instructions.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go 1.5&#39;s vendor/ experiment</title>
      <link>https://icanhazdowntime.org/posts/2015-07-09-go-vendor-experiment/</link>
      <pubDate>Thu, 09 Jul 2015 00:00:00 +0000</pubDate>
      <guid>https://icanhazdowntime.org/posts/2015-07-09-go-vendor-experiment/</guid>
      <description>&lt;p&gt;Go versions before 1.5 did not provide any built in method for &lt;a href=&#34;https://groups.google.com/forum/m/#!topic/golang-dev/nMWoEAG55v8&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;vendoring&lt;/a&gt; packages. The tools that currently exist today (&lt;a href=&#34;http://github.com/tools/godep&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;godep&lt;/a&gt;, &lt;a href=&#34;https://github.com/jingweno/nut&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;nut&lt;/a&gt; and a few others) basically exploit the implementation details of &lt;strong&gt;&lt;em&gt;$GOPATH&lt;/em&gt;&lt;/strong&gt;. Go 1.5 however includes a “vendor experiment”. With this experiment &lt;code&gt;go&lt;/code&gt; commands will attempt to resolve dependencies in &lt;code&gt;vendor/&lt;/code&gt; directories.&lt;/p&gt;&#xA;&lt;p&gt;Russ Cox explains it fairly well in his &lt;a href=&#34;https://github.com/golang/go/commit/183cc0cd41f06f83cb7a2490a499e3f9101befff&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;commit message&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If there is a source directory d/vendor, then, when compiling a source file within the subtree rooted at d, import &amp;ldquo;p&amp;rdquo; is interpreted as import &amp;ldquo;d/vendor/p&amp;rdquo; if that exists.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Go &#43; Heroku : Hello World</title>
      <link>https://icanhazdowntime.org/posts/2015-04-17-go_plus_heroku_hello_world/</link>
      <pubDate>Fri, 17 Apr 2015 00:00:00 +0000</pubDate>
      <guid>https://icanhazdowntime.org/posts/2015-04-17-go_plus_heroku_hello_world/</guid>
      <description>&lt;!-- raw HTML omitted --&gt;&#xA;&lt;p&gt;This is a quick start guide to deploying a simple “Hello World” &lt;a href=&#34;http://golang.org/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Go&lt;/a&gt; web application to &lt;a href=&#34;http://heroku.com/&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Heroku&lt;/a&gt;. It is in no way comprehensive, but aims to provide links to supporting documentation. In many ways it is an updated version of the excellent &lt;a href=&#34;https://mmcgrana.github.io/2012/09/getting-started-with-go-on-heroku.html&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Getting Started With Go On Heroku&lt;/a&gt; guide done by &lt;a href=&#34;https://twitter.com/mmcgrana&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Mark McGranaghan&lt;/a&gt;.&lt;/p&gt;&#xA;&lt;p&gt;The guide is command line centric and examples assume basic proficiency with a shell on a UNIX (OS X, Linux, etc) operating system.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Why I Like Go</title>
      <link>https://icanhazdowntime.org/posts/2013-02-09-why-i-like-go/</link>
      <pubDate>Sat, 09 Feb 2013 00:00:00 +0000</pubDate>
      <guid>https://icanhazdowntime.org/posts/2013-02-09-why-i-like-go/</guid>
      <description>&lt;p&gt;I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by &lt;a href=&#34;https://twitter.com/alxsolomon&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Alex&lt;/a&gt;, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.&lt;/p&gt;&#xA;&lt;h2 id=&#34;goroutines&#34;&gt;&#xA;  Goroutines&#xA;  &lt;a class=&#34;heading-link&#34; href=&#34;#goroutines&#34;&gt;&#xA;    &lt;i class=&#34;fa-solid fa-link&#34; aria-hidden=&#34;true&#34; title=&#34;Link to heading&#34;&gt;&lt;/i&gt;&#xA;    &lt;span class=&#34;sr-only&#34;&gt;Link to heading&lt;/span&gt;&#xA;  &lt;/a&gt;&#xA;&lt;/h2&gt;&#xA;&lt;p&gt;The first 1/2 of Go&amp;rsquo;s concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as &lt;code&gt;go f(x)&lt;/code&gt;, where &lt;code&gt;f()&lt;/code&gt; is a function.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
