Live data from Hacker News

Go port of SQLite without CGo

gitlab.com

11–20 of 122 posts

Re: Go port of SQLite without CGo

#11

What approach is used here? WebAssembly (or something similar)? I see a bunch of huge Go files with architecture names.

It's hard to find actual info on this other than Reddit comments but the author wrote a C to Go compiler and then ran it on the SQLite C code base to get a SQLite Go code base. Which means you don't need CGo to embed SQLite if you use that version. https://gitlab.com/cznic/ccgo Edit: Look around the source for "ccgo". Like https://gitlab.com/cznic/sqlite/-/blob/master/doc.go#L202 and look for "ccgo" in the closed iss…

Wow! It consumes C ASTs and produces Go code? That is much more impressive than what I had suspected (and what I would have done).

Re: Go port of SQLite without CGo

#12
I've use this. Slightly slower, but for my use case that was fine (a small blog) and immeasurably better doing away with all the CGO hassle. Especially when I might cross compile to an Arm architecture, or some docker container that uses a different approach to the c libraries (like Alpine vs Ubuntu Server or whatever) it was always a hassle, and thats all gone away now.

Always seemed silly that one of the most popular storage technologies couldn't be accessed with pure Go.

Re: Go port of SQLite without CGo

#14

I've use this. Slightly slower, but for my use case that was fine (a small blog) and immeasurably better doing away with all the CGO hassle. Especially when I might cross compile to an Arm architecture, or some docker container that uses a different approach to the c libraries (like Alpine vs Ubuntu Server or whatever) it was always a hassle, and thats all gone away now. Always seemed silly that one of the most popul…

>Always seemed silly that one of the most popular storage technologies couldn't be accessed with pure Go.

I don't know why Google didn't pay someone to do this or do it themselves. Surely they use Go and sqlite together.

Re: Go port of SQLite without CGo

#15

I've use this. Slightly slower, but for my use case that was fine (a small blog) and immeasurably better doing away with all the CGO hassle. Especially when I might cross compile to an Arm architecture, or some docker container that uses a different approach to the c libraries (like Alpine vs Ubuntu Server or whatever) it was always a hassle, and thats all gone away now. Always seemed silly that one of the most popul…

Pretty much any database is NOT written in Go, so what's the difference?

Re: Go port of SQLite without CGo

#17

I've use this. Slightly slower, but for my use case that was fine (a small blog) and immeasurably better doing away with all the CGO hassle. Especially when I might cross compile to an Arm architecture, or some docker container that uses a different approach to the c libraries (like Alpine vs Ubuntu Server or whatever) it was always a hassle, and thats all gone away now. Always seemed silly that one of the most popul…

>Always seemed silly that one of the most popular storage technologies couldn't be accessed with pure Go. I don't know why Google didn't pay someone to do this or do it themselves. Surely they use Go and sqlite together.

You’re overestimating the influence Google as a cooperation has on Go, you think they’re gonna pay for what they’re not gonna use ?

Re: Go port of SQLite without CGo

#18
post #8

If you cross-compile (which everybody using macOS to developer for Linux servers does), it's annoying to introduce SQLite to your project, because immediately the conventional `GOOS= GOARCH= go build` trick stops working. But, in case it's helpful, it's also really easy to set up a full cross-compiling environment, either with Zig or with Filippo's musl-cross: https://words.filippo.io/easy-windows-and-linux-cross-com…

Is there something like this for cross-compiling to FreeBSD?

Re: Go port of SQLite without CGo

#19

I've use this. Slightly slower, but for my use case that was fine (a small blog) and immeasurably better doing away with all the CGO hassle. Especially when I might cross compile to an Arm architecture, or some docker container that uses a different approach to the c libraries (like Alpine vs Ubuntu Server or whatever) it was always a hassle, and thats all gone away now. Always seemed silly that one of the most popul…

Pretty much any database is NOT written in Go, so what's the difference?

Other databases (Postgres, MySQL, etc.) already have clients written in pure Go. SQLite does not have a client/server architecture, so a pure Go version of it requires porting (or transpiling) the entire engine to Go.

Re: Go port of SQLite without CGo

#20

Earlier quoted context omitted.

>Always seemed silly that one of the most popular storage technologies couldn't be accessed with pure Go. I don't know why Google didn't pay someone to do this or do it themselves. Surely they use Go and sqlite together.

You’re overestimating the influence Google as a cooperation has on Go, you think they’re gonna pay for what they’re not gonna use ?

> you think they’re gonna pay for what they’re not gonna use

This is it. They have internal datastores that they use for nearly everything. They might be using SQLite somewhere for something, but I really doubt this would even land near the bottom of their priority list.

Post reply on HN