I just tested os.Readdir() on a friend's budget Windows laptop which has a consumer grade SATA SSD running on the slow cygwin over the ancient NTFS format.
os.Readdir() fetched 10.000 file names into a slice in 0.2s.
That's more than fine for most use cases and certainly doesn't look like "one of the stupidest, most broken interfaces I've ever seen".
Specially given that it's not the only way to iterate over files of a directory in Go. There's filepath.Walk() for one.
> The files are walked in lexical order, which makes the output deterministic but means that for very large directories Walk can be inefficient.
If it's fine for "most use cases," that's all well and good. Just implement the correct interface, which is fine for ALL use cases, and then implement this sugar on top of that.
os.Readdir() fetched 10.000 file names into a slice in 0.2s.
That's more than fine for most use cases and certainly doesn't look like "one of the stupidest, most broken interfaces I've ever seen".
Specially given that it's not the only way to iterate over files of a directory in Go. There's filepath.Walk() for one.