To add the code that handles updating the GUI and responding to user events, we will need to save references to some widgets that have been created; mainly the widget.Label toolbar and the main view, canvas.Image. By storing these references, we can update their content later.
Additionally, we will add a []string to list images for the directory we are accessing and save int index of the current image so that we can calculate the previous and the next. Once those are created, we can fill in the content of our previousImage() and nextImage() functions to call a new chooseImage() function that will update the display:
var images []stringvar index intvar image *canvas.Imagevar label *widget.Labelfunc previousImage ...