Now that we have a user interface up and running, we need to load some real data and display it. We start this task by obtaining a list of image files for the requested directory and updating the user interface to list those instead of the placeholder information. Remember, at this stage, to add the extra image imports so we can decode all of the images that we will then filter for in a new getImageList() function:
import ( _ "image/jpeg" _ "image/png" _ "image/gif")var names []stringfunc getImageList(dir string) []string { files, _ := ioutil.ReadDir(dir) for _, file := range files { if file.IsDir() { continue } ext := strings.ToLower(filepath.Ext(file.Name())) if ext == ".jpg" || ext == ".jpeg" || ext == ".png" ...