Commit Graph

11 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen bb8f1927f2
Return error instead of panic in WriteReader
See https://github.com/gohugoio/hugo/issues/4240
2018-01-15 20:27:20 +01:00
Joseph Salisbury 242208d9a2
Improves NeuterAccents godoc 2017-10-13 11:08:46 +01:00
Martin Bertschler 20500e2abd Merge pull request #93 from moorereason/no-defer-on-err
Immediately check for errors on fs.Open
2016-08-21 10:36:12 +02: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
Bjørn Erik Pedersen 0979251a4a Replace log.Fatal with log.Panic
Fixes #92
2016-06-27 02:21:49 +02:00
Francois Hill (fhill-wks) 3c4cfa198e Add `FullBaseFsPath` utility method
This method resolves the "Full" path of the `BasePathFs`. It also resolves for nested BasePaths.
Unit tests were also added
2016-04-20 14:12:23 +02:00
Bjørn Erik Pedersen 2f194a29d5 Add FileContainsAnyBytes 2016-02-17 11:33:17 +01:00
Bjørn Erik Pedersen 28789ef4b7 Add missing copyright to util.go
Using "The Hugo Authors" inside Hugo is fine, since the Git history shows the origin of the code.

By moving the code from Hugo to Afero (deleting the original), that history is lost -- or very hard to track.
2016-02-13 18:09:23 +01:00
Steve Francia e042b5f805 making the fs property accessible Afero.fs -> Afero.Fs 2015-12-08 16:26:39 -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