go-git / go-billy

The missing interface filesystem abstraction for Go
https://pkg.go.dev/github.com/go-git/go-billy/v5
Apache License 2.0
318 stars 43 forks source link

file.Sync is not implemented #86

Open wmcnamee-coreweave opened 3 weeks ago

wmcnamee-coreweave commented 3 weeks ago

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?

pjbgf commented 3 weeks ago

@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.