Commit Graph

350 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen a6023d20a1 github: Update Go build matrix 2023-02-23 10:17:14 +01:00
Bruno Michel 3b1116bc67
memmap: Fix renaming a dir with sub-directories (#239)
Fixes ##141
2023-02-23 10:05:23 +01:00
Bjørn Erik Pedersen a800a9de53 Fix concurrency issue in MemMapFs.Mkdir/MkdirAll
* The backing map is protected by a RWMutex
* This commit double checks for the existence of the directory inside the write lock to avoid potential data races when multiple goroutines tries to create
the same directory.

Fixes #361
Fixes #298
2022-11-14 18:51:03 +01:00
Bjørn Erik Pedersen 2a70f2bb2d Make mem.File implement fs.ReadDirFile 2022-07-19 12:29:51 +02:00
Bjørn Erik Pedersen 0aa65edf44 Fix sorting in IOFS.ReadDir
We recently added a check for fs.ReadDirFile in IOFS.ReadDir, but forgot to apply a sort to the
result as defined in the spec.

This fixes that and adds a test case for it.
2022-07-19 11:13:10 +02:00
Bjørn Erik Pedersen b0a534a781
Update README.md 2022-07-14 20:00:13 +02:00
Bjørn Erik Pedersen c92ae364de Make IOFS.ReadDir check for fs.ReadDirFile
And implement `fs.ReadDirFile` for `BasePathFile`.

There are other `File` implementations that could also benefit from the above, but
this is a start.

The primary motivation behind this is to allow `fs.WalkDir` use the native
implementation whenever possible, as that new function was added in Go 1.16 with
speed as its main selling point.

This commit also adds a benchmark for `fs.WalkDir` that, when compared to the main branch:

```bash
name        old time/op    new time/op    delta
WalkDir-10     369µs ± 1%     196µs ± 3%  -46.89%  (p=0.029 n=4+4)

name        old alloc/op   new alloc/op   delta
WalkDir-10    85.3kB ± 0%    40.2kB ± 0%  -52.87%  (p=0.029 n=4+4)

name        old allocs/op  new allocs/op  delta
WalkDir-10       826 ± 0%       584 ± 0%  -29.30%  (p=0.029 n=4+4)
```

Fixes #365
2022-07-14 15:11:09 +02:00
Bjørn Erik Pedersen 52b64170ec Fix staticcheck lint errors 2022-07-14 14:33:54 +02:00
Bjørn Erik Pedersen 939bf3d6b2 Fix test failures on Windows
And also enable the CI build for Windows.
2022-07-14 13:05:08 +02:00
Bjørn Erik Pedersen 9439436a4d all: Run gofmt -s -w 2022-07-14 13:05:08 +02:00
Bjørn Erik Pedersen 015be459f3
Move CI tests to GitHub Action 2022-07-14 12:38:08 +02:00
Michalis Kargakis 100c9a6d7b
Merge pull request #346 from jeffwidman/bump-minimum-go-version
Update `go.mod` to reflect that `afero` requires `go` >= `1.15.10`
2022-04-02 00:07:27 +02:00
Jeff Widman c45d7c7cf6 Bump minimum `go` version to `1.16`
As explained in
https://github.com/spf13/afero/pull/291#issuecomment-807324649, now that
`afero` supports `io/fs.FS`, it requires `go` >= `1.15.10`.

Rather than pinning to `1.15` and occasionally confusing users who are
on < `1.15.10`, I thought simplest to jump straight to `1.16`.

Especially given `1.18` was just released, the upstream `go` team no
longer even supports `1.16`.

The change to `go.sum` was the result of running `go mod tidy`.
2022-03-16 14:41:59 -07:00
Martin Bertschler 8d9b7958ba go mod tidy 2022-03-11 11:21:15 +01:00
Martin Bertschler a2bf4c852d
Merge pull request #329 from yearnfar/master
bugfix: RemoveAll
2022-03-11 11:19:41 +01:00
Martin Bertschler 931302a103
Merge pull request #340 from typerat/fix-gcsfs-removeall-notfound
Fix gcsfs RemoveAll
2022-03-11 11:19:07 +01:00
Christoph Armster b25fb10d4f clarify error message 2022-03-10 08:24:52 +01:00
Christoph Armster d6369bbece add test for RemoveAll 2022-02-22 09:31:52 +01:00
Christoph Armster 25e8a0a4c8 fix typo 2022-02-22 09:09:00 +01:00
Christoph Armster e08384e901 return no error if file doesn't exist 2022-02-22 09:06:46 +01:00
Michalis Kargakis 450b30f2bf
Merge pull request #334 from KastenMike/add-modTime-to-folders
add modTime on folder creation
2022-02-05 11:26:56 +01:00
KastenMike 94409215e4 fix actual value in test 2022-01-10 12:00:43 +01:00
KastenMike c2c1d1206e add modTime on folder creation 2022-01-10 11:50:49 +01:00
Michalis Kargakis cd35605009
Merge pull request #332 from pojntfx/master
Call `OpenFile` instead of `Open` in `CacheOnReadFs` (fixes #193)
2022-01-05 10:12:15 +01:00
Michalis Kargakis 8298014bef
Merge pull request #306 from lixiangzhong/master
sftpfs Readdirnames,Readdir
2022-01-05 10:03:44 +01:00
lixz 4806203f28
Merge branch 'master' into master 2022-01-05 10:46:36 +08:00
Michalis Kargakis d8a4ef9d05
Merge pull request #333 from drakkan/gcsfs
GCS fs: move all gcsfs related implementations to its own package
2021-12-28 23:53:39 +01:00
Nicola Murino 165e3dc3a5 GCS fs: move all gcsfs related implementations to its own package
this way we don't force any application that import afero to include
gcfs deps in its binary
2021-12-27 18:55:57 +01:00
Felix Pojtinger 039e386d52 Call `OpenFile` instead of `Open` in `CacheOnReadFs` (fixes #193) 2021-12-25 21:19:03 +01:00
Michalis Kargakis d70f944720
Merge pull request #331 from kargakis/gcs
Add GCS Fs implementation
2021-12-22 11:09:41 +01:00
Michalis Kargakis 68b71565dd
Add README section for GCS Fs 2021-12-22 11:03:34 +01:00
Michalis Kargakis 21b977b251
Merge branch 'master' into gcs 2021-12-22 11:03:13 +01:00
yearnfar 061c13d75b bugfix: RemoveAll
when i RemoveAll lib directory, it also Removed libs directory
2021-11-15 00:13:11 +08:00
Raphael Pour 949437f3b7 Readme: fix quotes of step 3
Single quotes are reserved for runes and therefore not allowed for strings in Go: `more than one character in rune literal`
2021-11-10 15:04:45 +01:00
Michalis Kargakis f0ee686ef7
Merge pull request #312 from tklauser/bump-deps
go.mod: bump dependencies to latest version
2021-11-10 10:36:00 +01:00
Tobias Klauser d461d4f875 go.mod: bump dependencies to latest version
github.com/pkg/sftp to v1.13.1 (this fixes a security vulnerability)
golang.org/x/crypto to v0.0.0-20211108221036-ceb1ce70b4fa
golang.org/x/text to v0.3.7
2021-11-10 10:29:42 +01:00
Martin Karlsch 090e652a76 read GOOGLE_APPLICATION_CREDENTIALS_JSON if it is set 2021-10-05 18:17:13 +02:00
VOvchinnikov c1220175da Added implementation to cover the new `Mkdir` & `MkdirAll` cases 2021-08-05 18:38:36 +02:00
VOvchinnikov 13ee679c8e Added test cases for `Mkdir` & `MkdirAll` to cover empty folder names 2021-08-05 18:24:24 +02:00
lixz 5b44be244d sftpfs OpenFile perm 2021-06-08 10:52:32 +08:00
lixz 5dc5331f47 sftpfs Readdirnames,Readdir 2021-05-27 15:44:56 +08:00
Vasily Ovchinnikov 78acf3b074 Changed abstraction to operate on client, not bucket 2021-04-14 13:08:40 +02:00
Vasily Ovchinnikov 1a0f20777f Add GCS Fs implementation 2021-04-12 20:07:21 +02:00
Michail Kargakis bc94f58bed
Merge pull request #287 from tdakkota/fix/issue-286
Fix incorrect (*mem.File).WriteAt
2021-03-20 15:22:17 +01:00
Michail Kargakis b9650fb6c8
Merge pull request #291 from xakep666/feature/iofs
Add adapter to allow afero.Fs usage as io/fs.FS
2021-03-20 15:18:02 +01:00
Vladimir Stolyarov 164e24d3b1
Add reverse wrapper from io.FS to afero.Fs
afero.Fs/File requires mutating methods implementation but they will always return error because fs.FS is read-only.
ReadAt and Seek will return error if underlying fs.File doesn't implement them.
2021-03-13 22:50:37 +03:00
Vladimir Stolyarov c597fe5aa8
Add adapter to allow afero.Fs usage as io/fs.FS
It will not affect users of go older than 1.16 because files with `io/fs` import marked with build constraints
2021-03-13 21:09:09 +03:00
tdakkota 7b47fea3fc
fix(mem): do not overwrite old data in some cases (fixes #286) 2021-02-12 13:02:47 +03:00
Michail Kargakis 32b5faae5b
Merge pull request #280 from mfuterko/master
Fix a typo
2020-12-09 13:17:20 +01:00
Mike Futerko f3723fe04d Fix a typo 2020-12-08 20:57:36 +02:00