My First Go Lang Function: Walk a Folder

My first code in GoLang.

In [1]:
import (
    "fmt"
    "os"
    "path/filepath"
)

func main() {
    var files []string

    root := "/tmp/.com.google.Chrome.5i0BtB"
    err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
        files = append(files, path)
        return nil
    })
    if err != nil {
        panic(err)
    }
    for _, file := range files {
        fmt.Println(file)
    }
}
In [2]:
main()
/tmp/.com.google.Chrome.5i0BtB
/tmp/.com.google.Chrome.5i0BtB/Default
/tmp/.com.google.Chrome.5i0BtB/Default/Code Cache
/tmp/.com.google.Chrome.5i0BtB/Default/Code Cache/js
/tmp/.com.google.Chrome.5i0BtB/Default/Code Cache/js/index
/tmp/.com.google.Chrome.5i0BtB/Default/Code Cache/js/index-dir
/tmp/.com.google.Chrome.5i0BtB/Default/Code Cache/js/index-dir/the-real-index
/tmp/.com.google.Chrome.5i0BtB/Default/GPUCache
/tmp/.com.google.Chrome.5i0BtB/Default/GPUCache/data_0
/tmp/.com.google.Chrome.5i0BtB/Default/GPUCache/data_1
/tmp/.com.google.Chrome.5i0BtB/Default/GPUCache/data_2
/tmp/.com.google.Chrome.5i0BtB/Default/GPUCache/data_3
/tmp/.com.google.Chrome.5i0BtB/Default/GPUCache/index
/tmp/.com.google.Chrome.5i0BtB/Default/Preferences
/tmp/.com.google.Chrome.5i0BtB/Default/blob_storage
/tmp/.com.google.Chrome.5i0BtB/Default/blob_storage/038e823c-5176-4dec-8e3d-52469e731bc5
/tmp/.com.google.Chrome.5i0BtB/Default/chrome_debug.log
/tmp/.com.google.Chrome.5i0BtB/DevToolsActivePort
/tmp/.com.google.Chrome.5i0BtB/First Run
/tmp/.com.google.Chrome.5i0BtB/Local State