1. Go+SQLite user: No CGO
2. Go user
3. Wanting to use the library
4. Someone following a link from HN
5. ...Personally, I would add ~2 sentences in the order I outlined, and then I would reorient the list (currently library-first) in a use-case first arrangement like you mentioned.
I mean, realistically my git repos are a mess, so who am I to talk? But this one looks promising enough such that it's worth offering a bit of feedback.
4. Someone following a link from HN
I'm often confused when clicking through from HN and can't figure out from the website or README what the project is doing.
Keeps the signal to noise ratio higher.
You can (e.g.) easily whip up a small CLI that embeds an SQLite database in the binary [1], cross compile this to all the platforms Go supports [2], copy one file, and be reasonably sure it'll run in any of them.
This is an example of embedding a database in a binary (with go:embed), and opening it for reading/writing in memory. You can then save the modified copy to disk using the backup API:
[1]: https://pkg.go.dev/github.com/ncruces/go-sqlite3/vfs/memdb#e...
[2]: https://gist.github.com/asukakenji/f15ba7e588ac42795f421b48b...
It seems to me it's not about would C sqlite run or not on that platform but that there is still some other convenience, and that's what I'd still like to learn, as I'm sure ncruces does solve some specific problem.
To cross compile from your platform A to that platform B, you need a cross compiler, which may be even harder to come by.
If you're working on a Go project, you already have a Go compiler that can do this (cross compilation) very easily, out of the box.
But if you add a C dependency, you also need a C cross compiler. SQLite is easy to configure, and very portable, but this still adds some friction.
Then if you want to setup CI, you need all this infra in CI. If you want to automate releases for a bunch of platforms, you need all of it in your release process.
I'm not saying it's a huge pain but it's enough that some projects avoid cgo as a matter of principle.
I'm surely aware of the fact that C cross-compilation is often very clumsy implemented. But I also have to mention that there is a project that also tries to solve that too, while also creating a whole new language:
https://zig.news/kristoff/building-sqlite-with-cgo-for-every...
We ran into this recently as our CI system is running a newer OS than we currently deploy to - and disabling CGO was an easy way to sidestep this requirement
Not sure SQLite is tested in this configuration, for the fans of “this didn't pass TH3 so we can't trust it at all.”
—-