rakyll / statik

Embed files into a Go executable
Apache License 2.0
3.76k stars 224 forks source link

fs: handle Readdir(0) same as Readdir(< 0) #69

Closed dmitshur closed 5 years ago

dmitshur commented 5 years ago

Implementations of the File.Readdir method are expected to treat all n <= 0 values the same, returning all the os.FileInfo structures from the directory in a single slice. This is documented at https://godoc.org/net/http#File.Readdir and https://godoc.org/os#File.Readdir.

Previously, the n == 0 value was not being handled correctly. This change fixes it by making it work the same as all other negative values of n.

Add a test case for it.

Also simplify string(out.Bytes()) to just out.String() in a test.

Fixes #68. Fixes shurcooL/httpfs#8. Closes shurcooL/httpfs#9.

rakyll commented 5 years ago

Thanks!

dmitshur commented 5 years ago

Thanks for reviewing!