5 ms·
> The go command now supports including static files and file trees as part of the final executable, using the new //go:embed directive Can this be used to imb
by ed25519FUUU 6y ago
> The go command now supports including static files and file trees as part of the final executable, using the new //go:embed directive
Can this be used to imbed a dynamically growing SQLiteDB? If so that would be a killer feature.
Unfortunately SQLite with Go still requires the remote host to have a c compiler (must use CGO), which makes even a static binary much less portable.
- mseepgood 6y ago> Can this be used to imbed a dynamically growing SQLiteDB? It's read-only.
- the_mitsuhiko 6y agoSelf modifying executables are both a bad idea and generally flagged by virus scanners. So embedding the db in the executable I would say is a pretty big no no.
- kodah 6y agoThis seems, at least on the facade, like a bad idea. Binaries being immutable is one of the more concrete things we know about a system. It's why hashing a binary is effective in the first place. I read this feature as beneficial for folks who do not need to scale frontends and want to embed resources in the binary to that end. This was already possible before but it looks like they just gave us an official channel for doing so.
- deleted 6y ago[deleted]
- lima 6y ago> Unfortunately SQLite with Go still requires the remote host to have a c compiler (must use CGO) No, you just need the shared object.
- didip 6y agoYou should probably embed table schema DDL only. If you need to export the SQLite, it is better to write a separate goroutine that exports the SQLite file into a remote storage like S3.
- benhoyt 6y agoI don't exactly know how production-ready it is, but there's https://pkg.go.dev/modernc.org/sqlite https://pkg.go.dev/modernc.org/sqlite, which is an automated transliteration of SQLite's C code to Go, so that it can be used with CGo.
- yobert 6y agoEven if I think this is a terrible idea--- You should try it and write up how it goes... :D