I have had a node app that watches for changes to my Raspberry Pi’s GPIO pins and sends an MQTT message as part of my home automation setup. Recently I re-imaged my pi and much to my dismay really struggled to install the requisite libraries.
Instead of banging my head against that wall any longer, I rewrote the app in go.
There isn’t much to it, but you can find the source code here: https://github.com/heathbar/raspi-gpio-mqtt