Created
June 24, 2017 17:43
-
-
Save prateek/8e001b11655f74632bc5c1b0278ec40b to your computer and use it in GitHub Desktop.
getFileList #golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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