-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
Milestone
Description
Hi, I noticed that if you run ioutil.ReadDir("/some/file.txt"), it succeeds and returns an empty array of os.FileInfo and no error. I would expect an error, since the input is a file, not a dir.
See
Line 100 in c007ce8
| func ReadDir(dirname string) ([]os.FileInfo, error) { |
Equivalent operations in the stdlib of, for example, Python are os.listdir, and this raises an error if you pass in a file instead of a directory.
Is this a bug, or is this the intended behavior? If the latter, why?
If it's a bug I'll be happy to submit a patch.
Thanks!