github.com/devseccon/trivy@v0.47.1-0.20231123133102-bd902a0bd996/pkg/mapfs/types.go (about) 1 package mapfs 2 3 import ( 4 "io/fs" 5 "time" 6 ) 7 8 // A fileStat is the implementation of FileInfo returned by Stat and Lstat. 9 // Ported from https://github.com/golang/go/blob/518889b35cb07f3e71963f2ccfc0f96ee26a51ce/src/os/types_unix.go 10 type fileStat struct { 11 name string 12 size int64 13 mode fs.FileMode 14 modTime time.Time 15 sys any 16 } 17 18 func (fstat *fileStat) Name() string { return fstat.name } 19 func (fstat *fileStat) Size() int64 { return fstat.size } 20 func (fstat *fileStat) Mode() fs.FileMode { return fstat.mode } 21 func (fstat *fileStat) IsDir() bool { return fstat.mode.IsDir() } 22 func (fstat *fileStat) ModTime() time.Time { return fstat.modTime } 23 func (fstat *fileStat) Sys() any { return &fstat.sys } 24 25 func (fstat *fileStat) Info() (fs.FileInfo, error) { return fstat, nil } 26 func (fstat *fileStat) Type() fs.FileMode { return fstat.mode }