Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow os.FileInfo impls to provide a *file.FileInfo #132

Merged
merged 3 commits into from
Apr 13, 2024

Conversation

ozkatz
Copy link
Contributor

@ozkatz ozkatz commented Apr 12, 2024

Use case: I have custom logic to determine the NFS File ID. Currently, the only to return it to clients is by returning a syscall.Stat_t from Sys(), which cannot work on Windows machines.

This PR introduces a small interface, which, if implemented by the os.FileInfo implementation, allows returning an explicit *file.FileInfo. If unimplemented, existing logic remains, so should be backwards compatible.

@willscott
Copy link
Owner

I wonder if it would be more direct to always call Sys() and then see if that is direct our FileInfo struct before attempting the platform-specific cast?

@ozkatz
Copy link
Contributor Author

ozkatz commented Apr 13, 2024

Done

@willscott willscott merged commit ea1b85e into willscott:master Apr 13, 2024
3 checks passed
@willscott
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants