go-billy icon indicating copy to clipboard operation
go-billy copied to clipboard

file.Sync is not implemented

Open wmcnamee-coreweave opened this issue 1 year ago • 1 comments

I was interested in atomic file writes using Billy interface, but I found that file.Sync method is not implemented.

e.g.

https://github.com/google/renameio/blob/master/tempfile.go#L150 https://github.com/tailscale/tailscale/blob/main/atomicfile/atomicfile.go#L44 https://github.com/natefinch/atomic/blob/master/atomic.go#L43

https://pkg.go.dev/os#File.Sync

Can this be implemented or a helper function added?

wmcnamee-coreweave avatar Oct 10 '24 03:10 wmcnamee-coreweave

@wmcnamee-coreweave we should be able to add support to it on both osfs implementations. But we won't be able to add it to the billy.Filesystem interface, due to the Liskov Substitution Principle.

Feel free to propose a PR for this.

pjbgf avatar Oct 10 '24 03:10 pjbgf