<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Filesystem on Feng-Chi's Notes</title><link>https://holmeslin.github.io/tags/filesystem/</link><description>Recent content in Filesystem on Feng-Chi's Notes</description><generator>Hugo -- gohugo.io</generator><language>zh-tw</language><lastBuildDate>Mon, 02 Nov 2026 14:00:00 +0800</lastBuildDate><atom:link href="https://holmeslin.github.io/tags/filesystem/index.xml" rel="self" type="application/rss+xml"/><item><title>用 os.Root 寫一個安全的 Go 檔案儲存</title><link>https://holmeslin.github.io/posts/go-os-root-safe-file-store/</link><pubDate>Mon, 02 Nov 2026 14:00:00 +0800</pubDate><guid>https://holmeslin.github.io/posts/go-os-root-safe-file-store/</guid><description>&lt;p&gt;讓使用者上傳檔案、存在伺服器的某個目錄底下，是很常見的需求。最直覺的寫法只要兩行，但這兩行藏了三個問題：檔名可以跳出目錄、寫到一半當機會留下殘檔、讀檔時可能被一個 FIFO 卡住整個 goroutine。&lt;/p&gt;
&lt;p&gt;這篇從最直覺的寫法開始，逐一修掉這三個問題。主角是 Go 1.24 新增的 &lt;code&gt;os.Root&lt;/code&gt;。&lt;/p&gt;</description></item></channel></rss>