<?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 ilikeorangutans</title><link>https://kuelzer.ca/tags/go/</link><description>Recent content in Go on ilikeorangutans</description><generator>Hugo</generator><language>en</language><copyright>© 2026 Jakob Külzer</copyright><lastBuildDate>Sun, 12 Apr 2026 14:49:25 -0400</lastBuildDate><atom:link href="https://kuelzer.ca/tags/go/index.xml" rel="self" type="application/rss+xml"/><item><title>zsh Autocompletion Caveat</title><link>https://kuelzer.ca/posts/2019/08/23/zsh-autocompletion-caveat/</link><pubDate>Fri, 23 Aug 2019 14:21:43 -0400</pubDate><guid>https://kuelzer.ca/posts/2019/08/23/zsh-autocompletion-caveat/</guid><description>&lt;p&gt;I spent a good hour trying to get a custom completion script working while porting my app &lt;a href="https://github.com/ilikeorangutans/harbormaster"&gt;Harbormaster&lt;/a&gt; to &lt;a href="https://github.com/spf13/cobra"&gt;Cobra&lt;/a&gt;. It would and would not work. I retried writing the file, restarting the shell and it would just not offer any completions.
Eventually I stumbled upon a innocent looking &lt;a href="https://github.com/zsh-users/zsh-completions/issues/277#issuecomment-72867242"&gt;post&lt;/a&gt; on Github that held the solution: remove the .zcompdump file which holds the cached completions. So I ran &lt;code&gt;rm ~/.zcompdump &amp;amp;&amp;amp; compinit&lt;/code&gt; and everything works as expected.&lt;/p&gt;</description></item><item><title>null, Software Design, and Scala's Option</title><link>https://kuelzer.ca/posts/2018/05/26/null-software-design-and-scalas-option/</link><pubDate>Sat, 26 May 2018 12:13:10 -0400</pubDate><guid>https://kuelzer.ca/posts/2018/05/26/null-software-design-and-scalas-option/</guid><description>&lt;p&gt;For the past year or so I&amp;rsquo;ve been writing a lot of Scala and fallen in love with its &lt;code&gt;Option&lt;/code&gt; type and how it allows me to avoid &lt;code&gt;null&lt;/code&gt;s. I reflected on &lt;code&gt;null&lt;/code&gt;, why they are bad, and how optional types allow you to write more expressive code.&lt;/p&gt;
&lt;h2 id="what-is-null"&gt;What is null?&lt;/h2&gt;
&lt;p&gt;Most programming languages have the concept of &lt;code&gt;null&lt;/code&gt; (or &lt;code&gt;nil&lt;/code&gt;) that represents the absence of a given value or object. At it&amp;rsquo;s surface the absence of a value probably just translates into a pointer of value &lt;code&gt;0x0&lt;/code&gt; or in languages that do not zero variables, a pointer anywhere into the memory. But aside from the implementation details the more interesting question is how &lt;code&gt;null&lt;/code&gt; fits into a language&amp;rsquo;s type system.&lt;/p&gt;</description></item><item><title>Google Appengine, Go, and Vendoring</title><link>https://kuelzer.ca/posts/2016/05/22/google-appengine-go-and-vendoring/</link><pubDate>Sun, 22 May 2016 13:59:40 -0400</pubDate><guid>https://kuelzer.ca/posts/2016/05/22/google-appengine-go-and-vendoring/</guid><description>&lt;p&gt;I&amp;rsquo;m working on a small app running on Google App engine using Go and upgraded to the latest version of the GAE SDK. The latest version uses Go 1.6 instead of 1.4 like the older version I had. Upgrading was mostly straightforward, but once I started using vendoring I got strange build errors like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;2016/05/22 13:26:47 go-app-builder: Failed parsing input: parser: bad import &amp;quot;syscall&amp;quot; in vendor/golang.org/x/net/ipv4/dgramopt_posix.go
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I got different variations of this, but all came down to the same problem: some code was importing packages that GAE doesn&amp;rsquo;t want you tu use. Sadly these errors don&amp;rsquo;t show up during normal &lt;code&gt;goapp build&lt;/code&gt; or &lt;code&gt;goapp test&lt;/code&gt; cycles, but only when you want to deploy or start a local devserver.&lt;/p&gt;</description></item><item><title>gorename and invalid expression</title><link>https://kuelzer.ca/posts/2015/10/23/gorename-and-invalid-expression/</link><pubDate>Fri, 23 Oct 2015 13:59:40 -0400</pubDate><guid>https://kuelzer.ca/posts/2015/10/23/gorename-and-invalid-expression/</guid><description>&lt;p&gt;This took me longer to figure out than I care to admit, so here&amp;rsquo;s the solution.&lt;/p&gt;
&lt;p&gt;The issue comes up when trying to use &lt;a href="https://godoc.org/golang.org/x/tools/cmd/gorename"&gt;gorename&lt;/a&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-console" data-lang="console"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gp"&gt;$&lt;/span&gt; gorename -from &lt;span class="s2"&gt;&amp;#34;github.com/ilikeorangutans/foo&amp;#34;&lt;/span&gt;.MyType -to &lt;span class="s1"&gt;&amp;#39;MyBetterType&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;gorename: -from &amp;#34;github.com/ilikeorangutans/foo.MyType&amp;#34;: invalid expression
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Even though the &lt;code&gt;from&lt;/code&gt; query looks normal, &lt;code&gt;gorename&lt;/code&gt; just refuses to work. However the issue is not so much with &lt;code&gt;gorename&lt;/code&gt; but rahter my shell, zsh. Turns out properly escaping your from query, fixes the issue:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-console" data-lang="console"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="gp"&gt;$&lt;/span&gt; gorename -from &lt;span class="s1"&gt;&amp;#39;&amp;#34;github.com/ilikeorangutans/foo&amp;#34;.MyType&amp;#39;&lt;/span&gt; -to &lt;span class="s1"&gt;&amp;#39;MyBetterType&amp;#39;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt;Renamed 15 occurrences in 5 files in 1 package.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Notice the single quotes around the entire &lt;code&gt;from&lt;/code&gt; parameter.&lt;/p&gt;</description></item><item><title>Using Golang and Graphviz to Visualize Complex Grails Applications</title><link>https://kuelzer.ca/posts/2014/05/03/using-golang-and-graphviz-to-visualize-complex-grails-applications/</link><pubDate>Sat, 03 May 2014 13:59:40 -0400</pubDate><guid>https://kuelzer.ca/posts/2014/05/03/using-golang-and-graphviz-to-visualize-complex-grails-applications/</guid><description>&lt;p&gt;At work we are maintaining several large and complex grails applications. In order to improve stability and reliability, we&amp;rsquo;re trying to increase test coverage. But as with all projects, time and resources are limited. In order to get a better understanding of what parts of the application are more important than others, I decided to use &lt;a href="http://www.graphviz.org/"&gt;Graphviz&lt;/a&gt; to help me get a better overview of our applications.&lt;/p&gt;
&lt;h3 id="meet-graphviz"&gt;Meet Graphviz&lt;/h3&gt;
&lt;p&gt;I discovered my love for the &lt;a href="http://www.graphviz.org/content/dot-language"&gt;dot language&lt;/a&gt; when I used it years ago to analyze template hierarchies in a proprietary CMS system I worked on. In a nutshell, it lets you specify a graph with nodes and edges plus some extra attributes for labels, shapes etc. It&amp;rsquo;s really a concise little language:&lt;/p&gt;</description></item><item><title>Golang Reading and Notes for April 2014</title><link>https://kuelzer.ca/posts/2014/04/27/golang-reading-and-notes-for-april-2014/</link><pubDate>Sun, 27 Apr 2014 13:59:40 -0400</pubDate><guid>https://kuelzer.ca/posts/2014/04/27/golang-reading-and-notes-for-april-2014/</guid><description>&lt;p&gt;Last week I attended the &lt;a href="http://golang.meetup.com/cities/ca/on/toronto/"&gt;Toronto Golang Usergroup Meetup&lt;/a&gt; and it was plenty of fun. If you&amp;rsquo;re in or near Toronto and like to dabble with Go, come out. Oh, and did I mention free pizza?&lt;/p&gt;
&lt;h3 id="notes"&gt;Notes&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Casting in Go is slightly different than in C related languages. Instead of a cast, you perform &lt;a href="http://golang.org/doc/effective_go.html#interface_conversions"&gt;a type conversion&lt;/a&gt;:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; var myVariable SomeGenericType = ...

 casted, ok := myVariable.(MoreSpecificType)
 // ok is a bool
 if ok {
 	// Type conversion successful
 } else {
 	// myVariable does not implement MoreSpecificType
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;The &lt;code&gt;range&lt;/code&gt; keyword when used with two return values does not return references, but rather copies. This had me struggle for a while as my code was not behaving as I thought it would. I had a slice of structs and was happily iterating over it:&lt;/p&gt;</description></item><item><title>First impressions: Go</title><link>https://kuelzer.ca/posts/2013/11/12/first-impressions-go/</link><pubDate>Tue, 12 Nov 2013 13:59:40 -0400</pubDate><guid>https://kuelzer.ca/posts/2013/11/12/first-impressions-go/</guid><description>&lt;p&gt;Ever since Google release &lt;a href="http://www.golang.org/"&gt;Go&lt;/a&gt; I&amp;rsquo;ve been curious. Many good things were said and I always read bits and pieces here and there. Last week I decided to dive deeper and write some small things and get to know the language.&lt;/p&gt;
&lt;p&gt;So far I&amp;rsquo;m really impressed. This is a quick list of things I&amp;rsquo;ve noticed:&lt;/p&gt;
&lt;h3 id="language"&gt;Language&lt;/h3&gt;
&lt;p&gt;The go language is full of nice surprises. I haven&amp;rsquo;t seen everything, but just a few things that really impressed me:&lt;/p&gt;</description></item></channel></rss>