
* compiles * mock fs in tests * fix parser tests * fix run.go * rename FeatureFS to FS * fix docs typos * remove debug log * add os.DirFS("./") to default options * reword docstring * add fs wrapper * updated readme and changelog * added note * fix changelog * remove ./ gating from defaults * add new storage.FS tests * increase coverage of parser.parsePath * increase coverage of TestSuite.RetrieveFeatures * remove another os.Stat --------- Co-authored-by: Tighearnán Carroll <tighearnan.carroll@gamil.com>
21 строка
318 Б
Go
21 строка
318 Б
Go
package storage
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
)
|
|
|
|
// FS is a wrapper that falls back to `os`.
|
|
type FS struct {
|
|
FS fs.FS
|
|
}
|
|
|
|
// Open a file in the provided `fs.FS`. If none provided,
|
|
// open via `os.Open`
|
|
func (f FS) Open(name string) (fs.File, error) {
|
|
if f.FS == nil {
|
|
return os.Open(name)
|
|
}
|
|
|
|
return f.FS.Open(name)
|
|
}
|