Adding extra files to an already compiled binary using embed.FS

237 views
Skip to first unread message

Pablo Caballero

unread,
May 11, 2023, 1:09:59 PM5/11/23
to golang-nuts
Hi folks! I tried to do my homework and I think that the response is "No." I'm just looking for confirmation (maybe I missed something).

We are using embed.FS to create "bundles" with a LOT of extra files embedded into the executable. So far so good until we hit a use case where we should be adding an extra tiny file depending on some user interaction to already-built bundles. We:
* would love to have this extra file in the embedded FS (We want to avoid delivering it as an extra file)
* would love not to have to recompile

Is there any way to achieve that?

Thank you for any help you can provide!

Best

TheDiveO

unread,
May 11, 2023, 5:08:04 PM5/11/23
to golang-nuts
What about merging two io.FS instance? A quick search positively surprises me, as there's https://pkg.go.dev/github.com/yalue/merged_fs for this already existing. So you could benefit from the build cache and yet add something later by merging/fusing multiple io.FS instances at runtime, from different packages. Deal...?

Pablo Caballero

unread,
May 11, 2023, 11:59:21 PM5/11/23
to TheDiveO, golang-nuts
Thank you! I'll definitely take a look at that.

Best!

--
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 golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/782798f0-404d-4546-a72d-b6a01faa9a7bn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages