Go for embedded devices (IoT, mobile etc.)

Hi Gophers,
Is Golang a good pick for embedded devices? What is its advantages over C/C++ for embedded devices?

Many thanks

Is Golang a good pick for embedded devices?

Probably? It has cgo (cgo command - cmd/cgo - Go Packages) and gobot (https://gobot.io/) so you can probably write in Go when it makes sense, and use c/c++ when you need to.

Ron Evans (https://twitter.com/deadprogram) has given some pretty cool demos of using Go with hardware and seems to be going all in on using Go instead of C/C++, but that is just one data point. I’d still check out some talks he gave to get an idea of what he has achieved.

What is its advantages over C/C++ for embedded devices?

This will vary for everyone. For me simply being able to write Go code instead of C/C++ code is a huge advantage and will allow me to write much clearer and more maintainable code because I have a lot more experience with Go. For you that might not be true at all.

1 Like

I’d say it depends to what point you call a device embedded. Does the Raspberry Pi count? In that case, yes, Go is perfectly suitable. In fact, I implemented an agriculture gateway with XBee devices in pure Go on a Pi Zero. And that probably holds for all of the Pi copies (Nano, orange, Banana, etc.), and similar devices like Beaglebone.

If you are thinking of more limited devices, there’s emgo, though it only supports ARM Cortex-M based MCUs.

And as John mentioned, there’s gobot, which targets several devices.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.