Skip to content

Instantly share code, notes, and snippets.

@prateek
Created June 24, 2017 17:43
Show Gist options
  • Save prateek/8e001b11655f74632bc5c1b0278ec40b to your computer and use it in GitHub Desktop.
Save prateek/8e001b11655f74632bc5c1b0278ec40b to your computer and use it in GitHub Desktop.
getFileList #golang
// function to get list of files in a directory, recursively
getFileList := func(path string) map[string]struct{} {
fileList := make(map[string]struct{})
err = filepath.Walk(path, func(path string, f os.FileInfo, err error) error {
fileList[path] = struct{}{}
return nil
})
require.NoError(t, err)
return fileList
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment