Programming ESP8266 in Go language? Not yet. November 2016

I was wondering if it would be possible to use Go language to write code for ESP8266.

The very first search result seemed to be the right choice – Gobot.

I read the instructions and typed:

go get -d -u

After a while Go asked for password to I had no account there so I registered the account. And again:

go get -d -u

New error:

package cannot download, uses insecure protocol

Go was trying to get repository from Eclipse using unsecure HTTP. Luckily there was feature request to add switch for accessing insecure repositories by Go get – issue #9637. The solution was just to add “-insecure” parameter:

go get -insecure -d -u

New error:

# cd .; git clone .../projects/gobot/src/
fatal: repository '' does not exist
package exit status 128

Yay, that’s cute. I’ve searched through issue tracking system in hybridgroup/gobot and the answer was issue #339.

The workaround is to change line 4 in to:


Ron Evans recommended just to switch to dev branch.

Thanks to Go integration with Git it was very easy:

cd src/
git checkout dev
go get -d -u

Only after this sequence of steps from magic dance Gobot was ready to build application on my computer.

My next step was attempt to build MQTT ping. Easy? Just grab a code from documentation, paste it to file and run it.

go run mqtt-ping.go

Another funny error:

# command-line-arguments
./mqtt-ping.go:11: undefined: gobot.NewGobot
./mqtt-ping.go:13: undefined: "".NewMqttAdaptor

The documentation on the web is from master. Ou, but I switched to dev branch. What a simple mistake. I grabbed the code from github repo everything was ok.

cp  ./ .
go run mqtt_ping.go

The application was able to connect to Mosquitto Broker and send messages.

The last step would be to deploy it to ESP8266. Unfortunately this is not possible yet. The platform is not supported by Gobot and there is issue with plaftom-request #301.

Ok, never mind. It was interesting experiment and I can see potential of Go for programming IoT.

What will be my next experiment? Developing the code for ESP8266 using PlatformIO.

Facebook Comments
Rating: 1.5/5. From 2 votes.
Please wait...

19. November 2016 at 10:09 - IoT (Tags: , , ). Both comments and pings are currently closed.

One Response to “Programming ESP8266 in Go language? Not yet. November 2016”

  • Václav Šlajs says:

    Gorobot is using Firmata ( so it doesn’t mean they aim to run Go programs directly on Arduino like devices (or ESP8266). Firmata is protocol that you can use to control Arduino with Firmata firmware via serial line. So on the host you can use almost any programming language ( You can use ESP6288 and connect it via serial to host, but this is not so interesting like using wifi for communication. I have found an example how to use Firmata over wifi – You can try it, I believe it would not be complicated to use the same approach in Go.

    No votes yet.
    Please wait...