Debian Codegraph @

interp/realfs.go

raw symbols SCIP
1 package interp
2
3 import (
4 "io/fs"
5 "os"
6 )
7
8 // realFS complies with the fs.FS interface (go 1.16 onwards)
9 // We use this rather than os.DirFS as DirFS has no concept of
10 // what the current working directory is, whereas this simple
11 // passthru to os.Open knows about working dir automagically.
12 type realFS struct{}
13
14 // Open complies with the fs.FS interface.
15 func (dir realFS) Open(name string) (fs.File, error) {
16 f, err := os.Open(name)
17 if err != nil {
18 return nil, err
19 }
20 return f, nil
21 }