<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>go-patterns on Arrans Technical blog</title><link>https://arran4.github.io/blog/categories/go-patterns/</link><description>Recent content in go-patterns on Arrans Technical blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>technicalblog123@arran4.com (Arran Ubels)</managingEditor><webMaster>technicalblog123@arran4.com (Arran Ubels)</webMaster><copyright>Arran Ubels. This work is licensed under a &lt;a rel="license" href="http://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License&lt;/a>.</copyright><lastBuildDate>Thu, 27 Aug 2026 13:38:30 +0000</lastBuildDate><atom:link href="https://arran4.github.io/blog/categories/go-patterns/index.xml" rel="self" type="application/rss+xml"/><item><title>Asset Fingerprinting and Caching in Go</title><link>https://arran4.github.io/blog/post/2026/039-asset-hashing-in-go/</link><pubDate>Thu, 27 Aug 2026 13:38:30 +0000</pubDate><author>technicalblog123@arran4.com (Arran Ubels)</author><guid>https://arran4.github.io/blog/post/2026/039-asset-hashing-in-go/</guid><description>When building web applications, a common goal is to serve static assets (CSS, JavaScript, images, WASM) as quickly as possible. The most effective way to achieve this is aggressive HTTP caching. However, aggressive caching introduces a challenge: when you update an asset and deploy the new version, you must ensure that users receive the updated file rather than a stale, cached copy, while avoiding unnecessary downloads for unchanged assets.
The solution to this problem is asset fingerprinting (or content hashing).</description></item><item><title>The `go test -update` Convention for Golden Files</title><link>https://arran4.github.io/blog/post/2026/034-golden-test-update-convention/</link><pubDate>Fri, 14 Aug 2026 02:27:49 +0000</pubDate><author>technicalblog123@arran4.com (Arran Ubels)</author><guid>https://arran4.github.io/blog/post/2026/034-golden-test-update-convention/</guid><description>go test ./... -update is a common golden-test update convention, but -update is not built into go test. The repository&amp;rsquo;s test code defines that flag and uses it to decide whether to compare against or overwrite .golden files.
A typical implementation looks like:
1var update = flag.Bool(&amp;#34;update&amp;#34;, false, &amp;#34;update golden files&amp;#34;) 2 3//go:embed testdata/example.golden 4var exampleGolden []byte 5 6func TestSomething(t *testing.T) { 7 got := generateOutput() 8 9 golden := &amp;#34;testdata/example.</description></item><item><title>Testing File Systems: How I use MockFS, MapFS, and SimpleFS in Go</title><link>https://arran4.github.io/blog/post/2026/033-testing-fs-with-mapfs-mockfs/</link><pubDate>Fri, 14 Aug 2026 00:00:58 +0000</pubDate><author>technicalblog123@arran4.com (Arran Ubels)</author><guid>https://arran4.github.io/blog/post/2026/033-testing-fs-with-mapfs-mockfs/</guid><description>When building tools in Go that interact heavily with the file system, having a solid strategy for testing those interactions is critical. Direct coupling to os functions like os.MkdirAll or os.WriteFile makes testing cumbersome and slow.
In this post, I want to detail how I approach this by designing minimal file system interfaces and using in-memory implementations like MapFS and MockFS for tests.
Why This Matters in the Era of Agentic Coding Before diving into the code, it&amp;rsquo;s worth highlighting why robust, abstract testing environments are becoming even more critical today.</description></item></channel></rss>