Explainers · Short

Go embed: one binary in prod, live files in dev

Published
Duration
Language
English

Watch on YouTube ↗

Transcript

Text of the video's narration.

embed is easy in prod. Dev is where it hurts. go colon embed bakes your files into the binary at build time. Great for shipping. But in dev, every CSS tweak means a rebuild. Fix: program against io/fs.FS, not embed.FS. Prod file, tagged not dev, returns the embed.

Dev file returns os.DirFS. Same FileServer, same ParseFS. Run with dash tags dev, edit, refresh. No rebuild, no coffee break. Just remember: DirFS follows your working directory. Embed for the ship. Disk for the loop.

Sources

Credits and notes

  • Visuals and narration generated with AI tools.

More in this series · Explainers