<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>patterns on Arrans Technical blog</title><link>https://arran4.github.io/blog/tags/patterns/</link><description>Recent content in 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>Sun, 08 Mar 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://arran4.github.io/blog/tags/patterns/index.xml" rel="self" type="application/rss+xml"/><item><title>Go FSs Everywhere: Treat Side Effects as Dependencies</title><link>https://arran4.github.io/blog/post/2026/007-go-fss-everywhere/</link><pubDate>Sun, 08 Mar 2026 00:00:00 +0000</pubDate><author>technicalblog123@arran4.com (Arran Ubels)</author><guid>https://arran4.github.io/blog/post/2026/007-go-fss-everywhere/</guid><description>If your Go code calls os.Create, os.Stat, exec.LookPath, or net.Dial directly from business logic, your tests are forced to touch real side effects more often than necessary.
The pattern in this article is simple:
Define small interfaces for side effects. Inject real implementations in production. Inject fakes or in-memory versions in tests. This is why I encourage myfs.Stat(&amp;quot;file.txt&amp;quot;) (or whatever your project names it) over direct os.Stat(&amp;quot;file.txt&amp;quot;) in your core application code.</description></item><item><title>Go Memory FSs Everywhere in Test: Treat Side Effects as Dependencies</title><link>https://arran4.github.io/blog/post/2026/008-memory-fs-for-testing/</link><pubDate>Sun, 08 Mar 2026 00:00:00 +0000</pubDate><author>technicalblog123@arran4.com (Arran Ubels)</author><guid>https://arran4.github.io/blog/post/2026/008-memory-fs-for-testing/</guid><description>If your Go code calls os.Create, os.Stat, exec.LookPath, or net.Dial directly from business logic, your tests are forced to touch real side effects more often than necessary.
The pattern in this article is simple:
Define small interfaces for side effects. Inject real implementations in production. Inject in-memory fakes or standard library memory file systems in tests. This is why I encourage myfs.Stat(&amp;quot;file.txt&amp;quot;) (or whatever your project names it) over direct os.</description></item></channel></rss>