Skip to content

Instantly share code, notes, and snippets.

@jdoliner
Last active August 29, 2015 14:25
Show Gist options
  • Save jdoliner/c1db8ecae8e35afc78e2 to your computer and use it in GitHub Desktop.
Save jdoliner/c1db8ecae8e35afc78e2 to your computer and use it in GitHub Desktop.
func enumerateFiles(dirname string, cb func (string) error ) {
filepath.Walk(dirname, func(path string, f os.FileInfo, err error) error {
if !f.IsDir() {
if err := cb(path); err != nil {
return err
}
}
return nil
})
}
enumerateFiles("dir", func (file string) error {
...
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment