Commit Graph

11 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen 787d034dfe Return error in Readdir on regular mem file
Fixes 
2018-05-31 11:51:01 +02:00
Cameron Moore 529281e51b Remove unused code 2016-10-03 22:03:51 -05:00
Cameron Moore 8bf3f8b71f Immediately check for errors on fs.Open
Found with github.com/dominikh/go-staticcheck
2016-07-01 10:44:25 -05:00
Martin Bertschler 6a67f8a50b Remove FileExists error in MemMapFs.Rename when destination file exists, because os.Rename also doesn't return the error 2016-01-07 11:47:44 +01:00
Martin Bertschler 9d44c3003b add a test for twice calling Create on the same path 2015-12-11 11:02:03 +01:00
Steve Francia 69df1e98f2 Improve testing output 2015-12-10 15:13:17 -05:00
Cameron Moore 85a9c733f6 Fix closing and deleting of files in tests
A few things are fixed by this commit:

- check error value returned from `fs.RemoveAll` in `removeAllTestFiles`.
- Defer statements are a LIFO, and were out of order in some test functions.
- The TestReaddir* funcs were failing to close some file handles.
- `findNames` was opening file handles but ignoring them.  Bad.
2015-12-09 23:35:59 -06:00
Martin Bertschler 90b5a9bd18 Fix TestWalk to use the new setup functions and make it Windows ready
I had to wrap the setupTestFiles() function for this test, one for returning the root of the test dir and the other one to reuse the path that was returned from the first function. If this is not done setupTestDir writes into two different folders that are returned from os.TempDir() and the output of the two walk functions can't be compared.
2015-12-09 23:34:42 +01:00
Steve Francia 943d877c43 Fix remaining Windows bugs and tests 2015-12-09 15:37:15 -05:00
Steve Francia 28bccc4ad0 reorder all utility functions to have fs as 1st param
This is a BREAKING CHANGE to the Walk and ReadDir functions that
existed prior to this branch addition. This change is not done without
considerable thought.

Having FS come first is done for two reasons.
1: It's more idiomatic go
2: It's more logical. It allows the function signature to read easier
and flow from the broadest value to the most narrow.

For example, WriteReader would read..
writeReader on this fs, to this path (on that fs),
with this data (at that path, on that fs).

I believe that when the first two were implemented it wasn't at all
obvious that the order wasn't correct, nevertheless, permitting a
lot of new functions defined in an incorrect or inconsistent order
seems like the worst option.

It was decided that a breaking change today would be best, even if it
was mildly painful at the present.
2015-12-08 16:26:39 -05:00
Steve Francia 90555c1894 reorganize utils into afero package 2015-12-08 16:26:38 -05:00