From 2e9959daba2379f53a80081b8090f92ef3d528b3 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Tue, 22 Dec 2020 19:31:53 +0100 Subject: [PATCH] Added Chown to afero.Fs implementations. --- ricefs/fs.go | 3 +++ vfs/fallbackfs.go | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/ricefs/fs.go b/ricefs/fs.go index ea876c4..c2e9338 100644 --- a/ricefs/fs.go +++ b/ricefs/fs.go @@ -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 } diff --git a/vfs/fallbackfs.go b/vfs/fallbackfs.go index 48de8eb..5ffa6ed 100644 --- a/vfs/fallbackfs.go +++ b/vfs/fallbackfs.go @@ -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) })