Currently the most mature client library for Go is org.eclipse.paho.mqtt.golang.

Below is a simple example where we every second will publish the current time on the currentTime topic. We will also setup a subscriber that subscribes to all topics and the prints the payload and topic.

The full code example can be found here: https://github.com/CloudMQTT/go-mqtt-example