I have some code that walks through a directory to get the files, to operate on them and it uses IsDir()
to skip directories. However, a directory isn't properly being detected:
err = filepath.Walk(dir, func(path string, f os.FileInfo, err error) error {
if !f.IsDir() {
fileList = append(fileList, path)
}
return nil
})
Error:
Put app/javascripts: read public/app/javascripts: is a directory
I'm on OSX. Here's the directory listing:
drwxr-xr-x@ 6 me staff 204 Sep 25 11:28 javascripts
Is there a better way to detect directories?