func (file *fakeFile) Close() error {
	return file.file.Close()
}
Close via afero.File.Close
package filesystem
import (
	"fmt"
	"os"
	"path/filepath"
	"time"
	"github.com/spf13/afero"
)
type FakeFs struct {
	a afero.Afero
}
func NewFakeFs(fakeFsRoot string) (Filesystem, func(), error) {
	_, err := os.Stat(fakeFsRoot)
	if err == nil {
		err = os.RemoveAll(fakeFsRoot)
		if err != nil {
			return nil, nil, fmt.Errorf("failed to cleanup fake root dir %s. %s", fakeFsRoot, err)
		}
	} else if !os.IsNotExist(err) {
		return nil, nil, fmt.Errorf("failed to lstat fake root dir %s. %s", fakeFsRoot, err)
	}
	if err = os.MkdirAll(fakeFsRoot, os.FileMode(0755)); err != nil {
		return nil, nil, fmt.Errorf("failed to create fake root dir: %s. %s", fakeFsRoot, err)
	}
	return &FakeFs{a: afero.Afero{Fs: afero.NewBasePathFs(afero.NewOsFs(), fakeFsRoot)}},
		func() {
			os.RemoveAll(fakeFsRoot)
		},
		nil
}
func (fs *FakeFs) Stat(name string) (os.FileInfo, error) {
	return fs.a.Fs.Stat(name)
}
func (fs *FakeFs) Create(name string) (File, error) {
	file, err := fs.a.Fs.Create(name)
	if err != nil {
		return nil, err
	}
	return &fakeFile{file}, nil
}
func (fs *FakeFs) Rename(oldpath, newpath string) error {
	return fs.a.Fs.Rename(oldpath, newpath)
}
func (fs *FakeFs) MkdirAll(path string, perm os.FileMode) error {
	return fs.a.Fs.MkdirAll(path, perm)
}
func (fs *FakeFs) Chtimes(name string, atime, mtime time.Time) error {
	return fs.a.Fs.Chtimes(name, atime, mtime)
}
func (fs *FakeFs) ReadFile(filename string) ([]byte, error) {
	return fs.a.ReadFile(filename)
}
func (fs *FakeFs) WriteFile(filename string, data []byte, perm os.FileMode) error {
	return fs.a.WriteFile(filename, data, perm)
}
func (fs *FakeFs) TempDir(dir, prefix string) (string, error) {
	return fs.a.TempDir(dir, prefix)
}
func (fs *FakeFs) TempFile(dir, prefix string) (File, error) {
	file, err := fs.a.TempFile(dir, prefix)
	if err != nil {
		return nil, err
	}
	return &fakeFile{file}, nil
}
func (fs *FakeFs) ReadDir(dirname string) ([]os.FileInfo, error) {
	return fs.a.ReadDir(dirname)
}
func (fs *FakeFs) Walk(root string, walkFn filepath.WalkFunc) error {
	return fs.a.Walk(root, walkFn)
}
func (fs *FakeFs) RemoveAll(path string) error {
	return fs.a.RemoveAll(path)
}
func (fs *FakeFs) Remove(name string) error {
	return fs.a.Remove(name)
}
func (fs *FakeFs) Readlink(name string) (string, error) {
	return fs.a.Fs.(afero.Symlinker).ReadlinkIfPossible(name)
}
func (fs *FakeFs) Symlink(oldname, newname string) error {
	return fs.a.Fs.(afero.Symlinker).SymlinkIfPossible(oldname, newname)
}
type fakeFile struct {
	file afero.File
}
func (file *fakeFile) Name() string {
	return file.file.Name()
}
func (file *fakeFile) Write(b []byte) (n int, err error) {
	return file.file.Write(b)
}
func (file *fakeFile) Sync() error {
	return file.file.Sync()
}