Added Chown to afero.Fs implementations.

This commit is contained in:
Sander Schobers 2020-12-22 19:31:53 +01:00
parent d7e3dfdb0f
commit 2e9959daba
2 changed files with 8 additions and 0 deletions

View File

@ -97,5 +97,8 @@ func (f *RiceFs) Name() string {
// Chmod is not supported for a RiceFs.
func (f *RiceFs) Chmod(name string, mode os.FileMode) error { return ErrReadOnly }
// Chown changes the uid and gid of the named file.
func (f *RiceFs) Chown(name string, uid, gid int) error { return ErrReadOnly }
// Chtimes is not supported for a RiceFs.
func (f *RiceFs) Chtimes(name string, atime time.Time, mtime time.Time) error { return ErrReadOnly }

View File

@ -106,6 +106,11 @@ func (f *FallbackFs) Chmod(name string, mode os.FileMode) error {
return f.do(func(fs afero.Fs) error { return fs.Chmod(name, mode) })
}
// Chown changes the uid and gid of the named file.
func (f *FallbackFs) Chown(name string, uid, gid int) error {
return f.do(func(fs afero.Fs) error { return fs.Chown(name, uid, gid) })
}
// Chtimes changes the access and modification times of the named file.
func (f *FallbackFs) Chtimes(name string, atime time.Time, mtime time.Time) error {
return f.do(func(fs afero.Fs) error { return fs.Chtimes(name, atime, mtime) })