What does HackerNews think of go-sqlite3?

sqlite3 driver for go using database/sql

Language: C

#23 in Go
Would Go's concurrency be an issue for SQLite too?

Edit: I looked into a common Go driver for SQLite[1] and the FAQ reads,

> Can I use this in multiple routines concurrently?

> Yes for readonly. But not for writable. See #50, #51, #209, #274.

Every time I see a blog post from fly.io reg SQLite I'm tempted to use it for my next project, But the need to rewrite my framework for limited data types and the doubts regarding concurrency keeps me away.

[1] https://github.com/mattn/go-sqlite3

The default go sqlite driver is https://github.com/mattn/go-sqlite3, which is quite lovely, but I ran into issues with concurrency on read only databases.

I'm now using https://github.com/crawshaw/sqlite and it seems to address those issues (but I haven't gotten around to setting up a proper test to confirm). It may be worth perusing if you do run into performance problems. It does come with the caveat of not being a database/sql driver though.

Using https://github.com/mattn/go-sqlite3 for a pet project right now. So far not a single issue with it, I never had to think about any CGO specifics.
I admit I only used sqlite through the go driver (https://github.com/mattn/go-sqlite3) where using fts5 amounts to one flag during the compile phase.
> To be honest I don't know how to solve that issue

Support more compilers (e.g. clang, msvc). It can be more work than it's worth, sure and I understand the issues there, but jumping through hoops per platform (e.g. can't use a popular lib like https://github.com/mattn/go-sqlite3 on Windows without a MinGW gcc installation) is worth noting when touting the cross platform ease of use. Langs like Rust were lucky to compile to the same IR as a cross-platform C compiler.

> I wonder how someone who has C/C++ experience thinks of Go as not being a cross platform language.

I don't think that and definitely never would. I said it has issues, namely in the Cgo department. And I said that the other statement about C/C++ only being Unixy was wrong.

I definitely like Go and its cross-platform ability and hope I didn't give the impression that I don't.

For those who don't want to wait for this to be completed, there is already

https://github.com/mattn/go-sqlite3

I had no problems building go-sqlite3[1] on Windows 7 x64 using the toolchain provided by the Win-Builds project[2]. It's using gcc 4.8 and sqlite 3.10, so maybe that doesn't hit your meaning of "recent versions". It was certainly recent and easy enough for my needs :)

[1] https://github.com/mattn/go-sqlite3

[2] http://win-builds.org/

Note that using a sqlite wrapper like https://github.com/mattn/go-sqlite3, you also don't have any external dependencies and your application still ships as a single binary. However, there are other advantages of a Go-native storage library (e.g., doesn't require cgo, better integration with tools like pprof, etc.)