Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rowland66 committed Oct 4, 2023
1 parent 273d9cf commit c1b398d
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions internal/storage/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package storage
import (
"errors"
"fmt"
"io"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -131,28 +130,3 @@ func (fs *filesystem) WriteFile(path string, contents []byte) error {

return nil
}

func (fs *filesystem) GetFileWriter(path string) (io.Writer, func() error, error) {
dir, path := filepath.Split(path)
dir = filepath.Join(fs.root, dir)

if err := os.MkdirAll(dir, 0777); err != nil {
return nil, nil, err
}

f, err := os.Create(filepath.Join(dir, path))
if err != nil {
return nil, nil, fmt.Errorf("GetFileWriter: %v", err)
}

continuation := func() error {
defer f.Close()
err = f.Sync()
if err != nil {
return fmt.Errorf("WriteFile: %v", err)
}
return nil
}

return f, continuation, nil
}

0 comments on commit c1b398d

Please sign in to comment.