You can try this code right away.
The only thing that do is to show a simple message with an icon in the system tray; that's all.
Let's split up this a bit. In out main() the only thing that we do is to call a new instance of the library systray with the function Run, this function receives a couple a parameters where we are defining what to do onReady and when the application exits.SetIcon, SetTitle and SetTooltip are pretty straightforward. The only thing we should have in consideration is that SetIcon takes as parameter the icon we want to display as a []byte. We use the function getIcon to read the .ico file and return the []byte.

Now, we don't want to have I'm alive! as title, so we are going to update each second with the local value of the timer; let's update our onReady() function and add a couple more that help us to get the time value:

funconReady(){systray.SetIcon(getIcon("assets/clock.ico"))for{systray.SetTitle(getTime())systray.SetTooltip("Look at me, I'm a tooltip!")time.Sleep(1*time.Second)}}funcgetTime()string{t:=time.Now()hour,min,sec:=t.Clock()returnItoaTwoDigits(hour)+":"+ItoaTwoDigits(min)+":"+ItoaTwoDigits(sec)}// ItoaTwoDigits time.Clock returns one digit on values, so we make sure to convert to two digitsfuncItoaTwoDigits(iint)string{b:="0"+strconv.Itoa(i)returnb[len(b)-2:]}

If we run, we'll see our clock being updated each second; but this is not the best way to implement an autoupdater. Implementing time.Sleep() will let us pause current instance, but we don't want to block our main process. In this case we are going to use a Go routine.

gofunc(){for{systray.SetTitle(getTime())systray.SetTooltip("Look at me, I'm a tooltip!")time.Sleep(1*time.Second)}}()

Now it's time to add some menu items. We can easily do it with systray.AddMenuItem("Title", "Tooltip"). This function returns us a channel when pressed. So, I'm going to add some items like this.

Good article Oscar, I was implementing a sys tray icon for Iris using this library some months ago but it's not really cross-platform by-default, it requires from user to install some dependencies, i.e some linux packages (on windows systems it works out-of-the-box), so be careful when using this library, your users will not be able to run your package with just go get!