-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Closed
Copy link
Labels
Milestone
Description
The current doc comment for File.Readdir
here states that when n > 0
, the error value will be populated if no FileInfo is returned. The reproduction I linked below clearly shows this isn't always the case, at least with the dir_unix.go
implementation of it here.
It is trivial to reproduce this using the following example program: https://gist.github.com/euank/72cc2f1d13630eecd5459d8fe68e60b6
Should the documentation be changed, or should the implementation be fixed to error correctly if the implementation-specific method did not behave as the documentation suggests it should?
I'd be happy to submit a patch for this either way.
What version of Go are you using (go version
)?
go version devel +e6f9f39 Mon Aug 29 18:25:33 2016 +0000 linux/amd64
What operating system and processor architecture are you using (go env
)?
amd64, linux
What did you do?
# Download the repro from https://gist.github.com/euank/72cc2f1d13630eecd5459d8fe68e60b6
$ go run readdir_bug.go | grep "this is a bug"
Observed err=<nil> and files=[]; this is a bug