Skip to content

Commit 61e52df

Browse files
committed
osfs: Override the WriteTo interface
The WriteTo signature for osfs.file has been changed so that it is no longer a io.WriterTo implementation. The built-in implementation of WriterTo is rather inefficient when coupled with go-git. Further investigation is required to understand whether this is an upstream issue or something very specific to osfs.BoundOS + go-git. Note that this only affects osfs.BoundOS, as ChrootHelper already ensures that osfs.ChrootOS does not implement io.WriterTo. Signed-off-by: Paulo Gomes <[email protected]>
1 parent 7625c6c commit 61e52df

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

osfs/os.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ package osfs
66

77
import (
88
"fmt"
9+
"io"
910
"io/fs"
1011
"os"
1112
"sync"
@@ -109,3 +110,8 @@ type file struct {
109110
*os.File
110111
m sync.Mutex
111112
}
113+
114+
func (f *file) WriteTo(w io.Writer) error {
115+
_, err := f.File.WriteTo(w)
116+
return err
117+
}

0 commit comments

Comments
 (0)