func (fs *VirtualFileSystem) RemoveAll(path string) error {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	paths := make(map[string]struct{})
	for k := range fs.files {
		if strings.HasPrefix(k, path) {
			paths[k] = struct{}{}
		}
	}
	if len(paths) == 0 {
		return errNotFound{os.ErrNotExist}
	}
	for k := range paths {
		delete(fs.files, k)
	}
	return nil
}
RemoveAll takes a path, removes a potential file, if no file doesn't exist it
will return not found.
package fsys
import (
	"bytes"
	"io"
	"os"
	"path/filepath"
	"strings"
	"sync"
	"time"
	"github.com/pkg/errors"
)
type VirtualFileSystem struct {
	mutex sync.RWMutex
	files map[string]*virtualFile
}
func NewVirtualFileSystem() *VirtualFileSystem {
	return &VirtualFileSystem{
		files: map[string]*virtualFile{},
	}
}
func (fs *VirtualFileSystem) Create(path string) (File, error) {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	f := &virtualFile{
		name:  path,
		atime: time.Now(),
		mtime: time.Now(),
	}
	fs.files[path] = f
	return f, nil
}
func (fs *VirtualFileSystem) Open(path string) (File, error) {
	fs.mutex.RLock()
	defer fs.mutex.RUnlock()
	f, ok := fs.files[path]
	if !ok {
		return nil, errNotFound{os.ErrNotExist}
	}
	return &virtualFile{
		name:  f.name,
		atime: f.atime,
		mtime: f.mtime,
		buf:   *bytes.NewBuffer(f.buf.Bytes()),
	}, nil
}
func (fs *VirtualFileSystem) OpenFile(path string, flag int, perm os.FileMode) (File, error) {
	return fs.Open(path)
}
func (fs *VirtualFileSystem) Rename(oldname, newname string) error {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	f, ok := fs.files[oldname]
	if !ok {
		return errNotFound{os.ErrNotExist}
	}
	delete(fs.files, oldname)
	fs.files[newname] = f
	return nil
}
func (fs *VirtualFileSystem) Exists(path string) bool {
	fs.mutex.RLock()
	defer fs.mutex.RUnlock()
	_, ok := fs.files[path]
	return ok
}
func (fs *VirtualFileSystem) Remove(path string) error {
	fs.mutex.Lock()
	defer fs.mutex.Unlock()
	if _, ok := fs.files[path]; !ok {
		return errNotFound{os.ErrNotExist}
	}
	delete(fs.files, path)
	return nil
}