Gokrazy: a pure-Go userland for Raspberry Pi 3 appliances - https://news.ycombinator.com/item?id=20357605 - July 2019 (9 comments)
Gokrazy: A pure-Go userland for Raspberry Pi 3 appliances - https://news.ycombinator.com/item?id=16672866 - March 2018 (87 comments)
It's intentionally not designed to be a drop in replacement for Bash though. I saw no point replicating all of the problems with Bash when writing a new shell. So it does a lot of things different -- better in most cases -- but that does also create a learning curve too (I mean you're literally learning a new language).
Edit to add: it would actually be difficult to do FFI or shell commands within gokrazy since there's no dynamic loader to resolve external symbols when you try to execute a dynamically linked library or program. You'd have to add this feature if you wanted to call out to anything built with a dynamically loaded C runtime (which is damn near everything these days, with one notable exception being Go executables built without CGO).
All up for trying this though and can definitely see real bonus in terms of less resource use within Pi envs!
Caddy is pure Go, no CGO. We did a bunch of work recently to ensure that none of the dependencies have any CGO code enabled (involved asking upstream dependencies to switch to pure alternatives).
They do provide a way to get one filesystem in place, but you can only interact with it using golang calls within your application.
“The term userland (or user space) refers to all code that runs outside the operating system's kernel.”
I see a difference between userland and user space. For userland I would add “and that’s needed to bring the OS to a usable state”. You need code that is triggered when an USB device is plugged in, tools to query what hardware is available, tools to format disks, etc.
“Usable state” is up for discussion, though. For example, I don’t think X11 or Wayland are needed, but opinions on that will vary. That may be why the table in the link I gave has parts shaded yellow.
I don’t think (but Wikipedia disagrees with that by making user space and userland synonymous) anybody calls QT, the Gimp or Open Office part of userland, even though they run in user space.
Has anyone tried it?
Apparently they have written their own init: https://gokrazy.org/userguide/process-interface/
This makes me curious. I wonder how well Gokrazy would blend with s6/s6-rc…
If anyone is curious there’s more info about those projects here:
It’s still kind of a toy, however. There is no C runtime, and the maintainer has declared that there never will be (part of the point of the project is not worrying about that kind of complexity) so including anything C-based is going to be an adventure/unsupported. And the maintainer’s use case is custom built personal servers, so he is explicitly ok with, for example, having to hardcode your wireless config because there is no (and apparently never will be) a wpa_supplicant.
But if it had a golang wpa_supplicant implementation and a graphics library (I’ve done a little fb drawing on it and it works but it really needs acceleration) it would make a really nifty platform for little devices with an HDMI UI.
You’re right about the lack of a C runtime being intentional. However, C programs can be run if you take on the task of keeping them up-to-date: https://gokrazy.org/prototyping/
Regarding WiFi, we have https://github.com/gokrazy/wifi which currently only works for unencrypted WiFi. If at some point there is a Go solution to configure encrypted WiFi, I’m all for it!