<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Arrays on A Blog for the Uninitialized</title><link>https://www.nilpointer.blog/tags/arrays/</link><description>Recent content in Arrays on A Blog for the Uninitialized</description><generator>Hugo</generator><language>en-us</language><copyright>&lt;a href="https://www.apache.org/licenses/LICENSE-2.0" target="_blank" rel="noopener"&gt;Licensed under Apache 2.0&lt;/a&gt;</copyright><lastBuildDate>Sat, 21 Feb 2026 12:33:28 -0800</lastBuildDate><atom:link href="https://www.nilpointer.blog/tags/arrays/index.xml" rel="self" type="application/rss+xml"/><item><title>A Golang Slice gotcha that...got me</title><link>https://www.nilpointer.blog/posts/2026/02/a-golang-slice-gotcha-that...got-me/</link><pubDate>Sat, 21 Feb 2026 12:33:28 -0800</pubDate><guid>https://www.nilpointer.blog/posts/2026/02/a-golang-slice-gotcha-that...got-me/</guid><description>&lt;p&gt;I was doing some self study the other day, feeling relatively confident building out a &lt;a href="https://en.wikipedia.org/wiki/Trie"
 
 
 target="_blank" 
 rel="noopener noreferrer"
 
&gt;Trie&lt;/a&gt; for an autocomplete function. When checking my work with Gemini, I was recommended something like this as a possible function signature:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;func (t *Trie) collect(n *TrieNode, pfx string, results *[]string) {
 // ...
}
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;Where I started to spiral was the &lt;strong&gt;&lt;code&gt;*[]string&lt;/code&gt;&lt;/strong&gt; type in the final input parameter.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;That&amp;rsquo;s weird looking, isn&amp;rsquo;t it?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In Golang, slices and arrays are often confused. You may say: &lt;em&gt;&amp;ldquo;But aren&amp;rsquo;t slices copied by reference?&amp;rdquo;&lt;/em&gt;&lt;/p&gt;</description></item></channel></rss>