-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Description
The documentation of the Sys method for the FileInfo interface says:
"underlying data source (can return nil)"
However the Windows implementation does not do this.
The underlying data source for the FileInfo implementation in the Stat function is
syscall.ByHandleFileInformation, however the Sys method returns syscall.Win32FileAttributeData.
The underlying data source for the FileInfo implementation in the Readdir method is syscall.Win32finddata, however the Sys method returns syscall.Win32FleAttributeData.
The advantage of the current implementation is that Sys returns the same dynamic type, as it is done on Unix systems. However the disadvantage is that some valuable information (VolumeInformation and FineIndex from the Stat call) is thrown away. The current implementation also has to allocate additional space.
Since the interface documentation seems to allow it, I propose that the Sys method returns the actual underlying data used by the implementation, ad discussed above.
The change does not break the go 1 compatibility promise.