<?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 Bill Glover</title>
		<link>https://old.bill.dev/tags/go/</link>
		<description>Recent content in Go on Bill Glover</description>
		<generator>Hugo</generator>
		<language>en-gb</language>
		
			<managingEditor>hello@bill.dev (Bill)</managingEditor>
		
		
			<webMaster>hello@bill.dev (Bill)</webMaster>
		
		
		
			<lastBuildDate>Sun, 28 Sep 2025 22:27:35 +0100</lastBuildDate>
		
			<atom:link href="https://old.bill.dev/tags/go/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Use the Kubernetes downwards API to set GOMEMLIMIT</title>
				<link>https://old.bill.dev/2022/09/14/use-the-kubernetes-downwards-api-to-set-gomemlimit/</link>
				<pubDate>Wed, 14 Sep 2022 21:10:06 +0100</pubDate><author>hello@bill.dev (Bill)</author>
				<guid>https://old.bill.dev/2022/09/14/use-the-kubernetes-downwards-api-to-set-gomemlimit/</guid>
				<description>&lt;p&gt;Go 1.19 introduced the ability to tune the way the garbage collector works by setting a soft memory limit. One recommendation is to use this new memory limit when deploying in a container environment. This post looks at using the Kubernetes Downward API to set this soft limit.&lt;/p&gt;&#xA;&lt;h2 id=&#34;do-i-need-a-soft-memory-limit&#34;&gt;Do I need a Soft Memory Limit&lt;/h2&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Do take advantage of the memory limit when the execution environment of your Go program is entirely within your control, and the Go program is the only program with access to some set of resources (i.e. some kind of memory reservation, like a container memory limit).&lt;/p&gt;&#xA;&lt;p&gt;A good example is the deployment of a web service into containers with a fixed amount of available memory.&lt;/p&gt;&#xA;&lt;/blockquote&gt;</description>
			</item>
			<item>
				<title>Use a forked Go module</title>
				<link>https://old.bill.dev/notes/use-forked-go-module/</link>
				<pubDate>Wed, 01 Jun 2022 11:19:16 +0100</pubDate><author>hello@bill.dev (Bill)</author>
				<guid>https://old.bill.dev/notes/use-forked-go-module/</guid>
				<description>&lt;p&gt;Whenever I want to work with a forked Go module, I have to look up how to do so. It doesn&amp;rsquo;t feel immediately obvious what to change. This note documents my current approach.&lt;/p&gt;&#xA;&lt;p&gt;I need to do this when a third party module I depend on doesn&amp;rsquo;t include features I need. I fork the third party module and make some changes. But these changes are only available in my fork. These may get merged into a new version of the module but in the meantime I want to continue working off my fork.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Build Multi-Architecture Docker Images</title>
				<link>https://old.bill.dev/notes/build-multi-arch-docker-images/</link>
				<pubDate>Fri, 01 Apr 2022 19:22:32 +0000</pubDate><author>hello@bill.dev (Bill)</author>
				<guid>https://old.bill.dev/notes/build-multi-arch-docker-images/</guid>
				<description>&lt;p&gt;Back in 2018, I wrote about &lt;a href=&#34;https://old.bill.dev/2018/10/30/multi-architecture-docker-builds/&#34;&gt;Multi-Architecture Docker Builds&lt;/a&gt;. My main aim then was to run the occasional container image on a Raspberry Pi. Apple&amp;rsquo;s transition to M1 based machines has increased demand for multi-architecture container images. In this post, I document an improved approach to building multi-architecture images.&lt;/p&gt;&#xA;&lt;p&gt;I’ll use a Go application to show the build process. It prints the current runtime OS and CPU architecture to the terminal and then exits.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Go on ARM: why struct field alignment matters</title>
				<link>https://old.bill.dev/2020/06/19/go-on-arm-why-struct-field-alignment-matters/</link>
				<pubDate>Fri, 19 Jun 2020 14:00:00 +0000</pubDate><author>hello@bill.dev (Bill)</author>
				<guid>https://old.bill.dev/2020/06/19/go-on-arm-why-struct-field-alignment-matters/</guid>
				<description>&lt;p&gt;I&amp;rsquo;d assumed the Go compiler provided a robust abstraction across CPU architectures. Code that ran on one CPU architecture would run on another. It turns out I was wrong. In this post, I provide a minimal example application that demonstrates the importance of field alignment when using &lt;code&gt;sync/atomic&lt;/code&gt; and &lt;code&gt;64-bit&lt;/code&gt; values.&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-go&#34; data-lang=&#34;go&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;package&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;fmt&amp;#34;&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;func&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;main&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;w&#34;&gt; &lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;w&#34;&gt;&#x9;&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;fmt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;Println&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Hello, 世界&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;&lt;span class=&#34;w&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;We can build and run this program on our local machine (in my case a MacBook) with the following command.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Learn Go: by Concatenating Strings</title>
				<link>https://old.bill.dev/2019/03/13/learn-go-by-concatenating-strings/</link>
				<pubDate>Wed, 13 Mar 2019 13:02:49 +0000</pubDate><author>hello@bill.dev (Bill)</author>
				<guid>https://old.bill.dev/2019/03/13/learn-go-by-concatenating-strings/</guid>
				<description>&lt;p&gt;Joining strings is so common that many of us take it for granted. While working through the exercises in &amp;lsquo;The Go Programming Language&amp;rsquo; book as part of the London Study Group, I wanted to understand the differences between the various approaches for joining strings.&lt;/p&gt;&#xA;&lt;p&gt;If you are looking to concatenate strings in Go, here is what I&amp;rsquo;d do:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Outside a loop: use the &lt;code&gt;+&lt;/code&gt; operator: e.g. `&amp;ldquo;a&amp;rdquo; + &amp;ldquo;b&amp;rdquo;&lt;/li&gt;&#xA;&lt;li&gt;Inside a loop: use &lt;code&gt;strings.Join([]string, string)&lt;/code&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;If you want to know why read on. The notes that follow are primarily for my own understanding. They chart my attempt to explain the results of exercise 1.3 and explore different options for string concatenation.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Beyond the Tour</title>
				<link>https://old.bill.dev/2019/02/24/beyond-the-tour/</link>
				<pubDate>Sun, 24 Feb 2019 20:28:46 +0000</pubDate><author>hello@bill.dev (Bill)</author>
				<guid>https://old.bill.dev/2019/02/24/beyond-the-tour/</guid>
				<description>&lt;p&gt;I love watching talks on technical subjects. However, I often find myself in a position where I understand the topic but am far more hesitant when it comes to the importance of the conclusion. As someone who tends to learn the most from practical experience, this lack of confidence often stems from the fact that I haven&amp;rsquo;t faced similar challenges to the speaker. This presents hurdles when self-learning, as it can be difficult to create complex technical setups required.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
