add a File interface so we can avoid to use os.File directly

This commit is contained in:
Nicola Murino
2020-11-17 19:36:39 +01:00
parent 969b38586e
commit ca0ff0d630
17 changed files with 63 additions and 47 deletions

View File

@@ -81,13 +81,13 @@ func (fs *OsFs) Lstat(name string) (os.FileInfo, error) {
}
// Open opens the named file for reading
func (*OsFs) Open(name string, offset int64) (*os.File, *pipeat.PipeReaderAt, func(), error) {
func (*OsFs) Open(name string, offset int64) (File, *pipeat.PipeReaderAt, func(), error) {
f, err := os.Open(name)
return f, nil, nil, err
}
// Create creates or opens the named file for writing
func (*OsFs) Create(name string, flag int) (*os.File, *PipeWriter, func(), error) {
func (*OsFs) Create(name string, flag int) (File, *PipeWriter, func(), error) {
var err error
var f *os.File
if flag == 0 {