summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/spf13/afero
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/spf13/afero')
-rw-r--r--vendor/github.com/spf13/afero/copyOnWriteFs.go5
-rw-r--r--vendor/github.com/spf13/afero/go.mod2
-rw-r--r--vendor/github.com/spf13/afero/go.sum2
-rw-r--r--vendor/github.com/spf13/afero/unionFile.go19
4 files changed, 24 insertions, 4 deletions
diff --git a/vendor/github.com/spf13/afero/copyOnWriteFs.go b/vendor/github.com/spf13/afero/copyOnWriteFs.go
index 9aef3979..e8108a85 100644
--- a/vendor/github.com/spf13/afero/copyOnWriteFs.go
+++ b/vendor/github.com/spf13/afero/copyOnWriteFs.go
@@ -267,7 +267,7 @@ func (u *CopyOnWriteFs) Mkdir(name string, perm os.FileMode) error {
return u.layer.MkdirAll(name, perm)
}
if dir {
- return syscall.EEXIST
+ return ErrFileExists
}
return u.layer.MkdirAll(name, perm)
}
@@ -282,7 +282,8 @@ func (u *CopyOnWriteFs) MkdirAll(name string, perm os.FileMode) error {
return u.layer.MkdirAll(name, perm)
}
if dir {
- return syscall.EEXIST
+ // This is in line with how os.MkdirAll behaves.
+ return nil
}
return u.layer.MkdirAll(name, perm)
}
diff --git a/vendor/github.com/spf13/afero/go.mod b/vendor/github.com/spf13/afero/go.mod
index 9eff4fed..08685509 100644
--- a/vendor/github.com/spf13/afero/go.mod
+++ b/vendor/github.com/spf13/afero/go.mod
@@ -1 +1,3 @@
module github.com/spf13/afero
+
+require golang.org/x/text v0.3.0
diff --git a/vendor/github.com/spf13/afero/go.sum b/vendor/github.com/spf13/afero/go.sum
new file mode 100644
index 00000000..6bad37b2
--- /dev/null
+++ b/vendor/github.com/spf13/afero/go.sum
@@ -0,0 +1,2 @@
+golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/vendor/github.com/spf13/afero/unionFile.go b/vendor/github.com/spf13/afero/unionFile.go
index 1e78f7d1..eda96312 100644
--- a/vendor/github.com/spf13/afero/unionFile.go
+++ b/vendor/github.com/spf13/afero/unionFile.go
@@ -155,7 +155,8 @@ var defaultUnionMergeDirsFn = func(lofi, bofi []os.FileInfo) ([]os.FileInfo, err
}
// Readdir will weave the two directories together and
-// return a single view of the overlayed directories
+// return a single view of the overlayed directories.
+// At the end of the directory view, the error is io.EOF if c > 0.
func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) {
var merge DirsMerger = f.Merger
if merge == nil {
@@ -185,9 +186,23 @@ func (f *UnionFile) Readdir(c int) (ofi []os.FileInfo, err error) {
}
f.files = append(f.files, merged...)
}
- if c == -1 {
+
+ if c <= 0 && len(f.files) == 0 {
+ return f.files, nil
+ }
+
+ if f.off >= len(f.files) {
+ return nil, io.EOF
+ }
+
+ if c <= 0 {
return f.files[f.off:], nil
}
+
+ if c > len(f.files) {
+ c = len(f.files)
+ }
+
defer func() { f.off += c }()
return f.files[f.off:c], nil
}