package utils import ( "os" "time" ) type FakeDir struct { Self os.FileInfo Content []os.FileInfo } func (f FakeDir) Close() error { return nil } func (f FakeDir) Read(p []byte) (n int, err error) { panic("implement me") } func (f FakeDir) Seek(offset int64, whence int) (int64, error) { panic("implement me") } func (f FakeDir) Readdir(count int) ([]os.FileInfo, error) { return f.Content, nil } func (f FakeDir) Stat() (os.FileInfo, error) { return f.Self, nil } type FakeFileInfo struct { name string size int64 mode os.FileMode modTime time.Time isDir bool sys interface{} } func (f *FakeFileInfo) Name() string { return f.name } func (f *FakeFileInfo) Size() int64 { return f.size } func (f *FakeFileInfo) Mode() os.FileMode { return f.mode } func (f *FakeFileInfo) ModTime() time.Time { return f.modTime } func (f *FakeFileInfo) IsDir() bool { return f.isDir } func (f *FakeFileInfo) Sys() interface{} { return f.sys } func ChangeFileInfoName(file os.FileInfo, newName string) *FakeFileInfo { return &FakeFileInfo{ name: newName, size: file.Size(), mode: file.Mode(), modTime: file.ModTime(), isDir: file.IsDir(), sys: file.Sys(), } }