This centralizes filestat logic by making our own `Stat_t` similar to `syscall.Stat_t`. This exposes utilities in the platform package and adds a new function `FS.Stat` which avoids having to use `fs.File` to get the same info. Doing so at the FS abstraction allows us to optimize how it is implemented internally using portable means (e.g. `os.StatFile`) or OS-specific means where necessary, e.g. in windows. This also ensures `platform.OpenFile` returns syscall.Errno and centralizes error checking with a new `require.EqualErrno` test. Signed-off-by: Adrian Cole <adrian@tetrate.io>
12 lines
141 B
Go
12 lines
141 B
Go
//go:build !windows
|
|
|
|
package sysfs
|
|
|
|
import (
|
|
"io/fs"
|
|
)
|
|
|
|
func maybeWrapFile(f file, _ FS, _ string, _ int, _ fs.FileMode) file {
|
|
return f
|
|
}
|