afero icon indicating copy to clipboard operation
afero copied to clipboard

iofs compatibillity Glob with unsorted directory

Open aligator opened this issue 3 years ago • 0 comments

Hi,

as noted in https://github.com/spf13/afero/issues/292 I got another error when testing my FAT filesystem using the afero IOFS wrapper:

When wrapping my fs with the wrapper, (after resolving the error from the other ticket) the fstest.TestFS gives me another error: (The code for this is again here, just run go generate && go test ./... - Note that the other issue has to be resolved / worked around before.)

It has problems when testing the Glob functionallity because it assumes that the order it gets from ReadDir(-1) is exactly the same as when calling Glob. The problem here is that the afero Glob sorts the output by name. In the match.go it calls sort.Strings(names).

When removing that, fstest.TestFS runs through.

Any ideas how to fix that without breaking afero backwards compatibility?

aligator avatar Mar 23 '21 12:03 aligator