mirror of https://github.com/spf13/afero.git
update README.md
This commit is contained in:
parent
313c5e8bb9
commit
3c24ee4601
|
@ -303,8 +303,8 @@ Like, `RegexpFs`, files will not be created when the predicate returns false
|
||||||
and directories are always not filtered.
|
and directories are always not filtered.
|
||||||
|
|
||||||
```go
|
```go
|
||||||
pred := func(path string) bool {
|
pred := func(isDir bool, path string) bool {
|
||||||
return strings.HasSuffix(path, ".txt")
|
return isDir || strings.HasSuffix(path, ".txt")
|
||||||
}
|
}
|
||||||
fs := afero.NewFilePredicateFs(afero.NewMemMapFs(), pred)
|
fs := afero.NewFilePredicateFs(afero.NewMemMapFs(), pred)
|
||||||
_, err := fs.Create("/file.html")
|
_, err := fs.Create("/file.html")
|
||||||
|
|
Loading…
Reference in New Issue