Given: I'm using CGO to call that C code that expects those files on disk.
Goal: I'd like to copy-in/compile-in all the files that would normally live
on disk, putting them into the go executable file.
Rationale: for easy (single executable binary, in classic Go style)
distribution of all the required files and directories that attend the CGO
Constraint: Ideally the C code in the libraries wouldn't have to be
modified in order to redirect its access to the filesystem embedded inside
Q: Is there an existing "filesystem within a file" library for Go? I'd
like OSX and linux support.
I imagine I could use LD_PRELOAD / DYLD_INSERT_LIBRARIES to hook
open/read/write calls and redirect them to the internal data. But then I
still need to have a "filesystem within a file" directory structure logic
implemented that lets me embed that filesystem in the file somewhere. The
filesystem can be read-only.
Are there any existing libraries or parts for such a job?
Caveat: I'd prefer to avoid the complexity and installation requirements of
a container/Docker/docker data volume.
I'm currently thinking I may need to resort to a single external database
file. Perhaps this file is managed by boltdb or bazil, then use LD_PRELOAD
-> hook filesystem open(),, read(), write() filesystem calls, and redirect
the filesystem operations that are to the "internal paths" to the
Seems like a dead-end: I could do some kind of loopback device/mount
scheme, but I don't see how to make a loopback device point to just part
(say the last half) of a file.
Thanks for your thoughts!
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firstname.lastname@example.org.
For more options, visit https://groups.google.com/d/optout.