<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>environment on Arrans Technical blog</title><link>https://arran4.github.io/blog/tags/environment/</link><description>Recent content in environment 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, 11 Oct 2026 02:42:55 +0000</lastBuildDate><atom:link href="https://arran4.github.io/blog/tags/environment/index.xml" rel="self" type="application/rss+xml"/><item><title>Stop Rebuilding XDG Directories in Go Unit Tests</title><link>https://arran4.github.io/blog/post/2026/054-stop-rebuilding-xdg-directories-in-go-tests/</link><pubDate>Sun, 11 Oct 2026 02:42:55 +0000</pubDate><author>technicalblog123@arran4.com (Arran Ubels)</author><guid>https://arran4.github.io/blog/post/2026/054-stop-rebuilding-xdg-directories-in-go-tests/</guid><description>A test that starts like this makes me ask whether we are testing application behaviour or rehearsing how a desktop session starts:
1t.Setenv(&amp;#34;XDG_RUNTIME_DIR&amp;#34;, runtimeDir) 2t.Setenv(&amp;#34;XDG_STATE_HOME&amp;#34;, filepath.Join(tempDir, &amp;#34;state&amp;#34;)) 3t.Setenv(&amp;#34;XDG_CACHE_HOME&amp;#34;, filepath.Join(tempDir, &amp;#34;cache&amp;#34;)) 4t.Setenv(&amp;#34;XDG_DOWNLOAD_DIR&amp;#34;, filepath.Join(tempDir, &amp;#34;downloads&amp;#34;)) 5tokenPath := filepath.Join(tempDir, &amp;#34;torbox.token&amp;#34;) None of these lines is automatically wrong. t.Setenv is the correct Go tool when a test genuinely needs to change the environment. filepath.Join is harmless on its own, and t.TempDir is a good tool for real filesystem integration tests.</description></item></channel></rss>