Does the embed have a plan to support writing

Does the embed have a plan to support writing?

I made modifications to the embedded file system files of the relative binary files。

If I understand correctly, you want to write to files embedded in the go-binary with “embed”. If you want your writes to persist across restarts, your code would need to write directly to the binary-executable file. I don’t think this is possible for multiple reasons. Usually the OS read-locks the binary which is currently executing - so you cannot change the binary file of your program, while it is being executed. And depending on the environment writing to the binary will break any signatures which are on the binary.

If you just want to write to the files in memory, this should be possible by using a caching layer which saves writes in memory. You could probably also create your own solution in a few lines of code, which writes changes to the embedded FS into an external file in the same directory as the binary. And a small interface between the embedded FS and your code would automatically search this file for persisted changes on read.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.