interp: do not export RealFS, used internally only
This commit is contained in:
@@ -312,7 +312,7 @@ type Options struct {
|
||||
// New returns a new interpreter.
|
||||
func New(options Options) *Interpreter {
|
||||
i := Interpreter{
|
||||
opt: opt{context: build.Default, filesystem: &RealFS{}},
|
||||
opt: opt{context: build.Default, filesystem: &realFS{}},
|
||||
frame: newFrame(nil, 0, 0),
|
||||
fset: token.NewFileSet(),
|
||||
universe: initUniverse(),
|
||||
|
||||
@@ -5,14 +5,14 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// RealFS complies with the fs.FS interface (go 1.16 onwards)
|
||||
// realFS complies with the fs.FS interface (go 1.16 onwards)
|
||||
// We use this rather than os.DirFS as DirFS has no concept of
|
||||
// what the current working directory is, whereas this simple
|
||||
// passthru to os.Open knows about working dir automagically.
|
||||
type RealFS struct{}
|
||||
type realFS struct{}
|
||||
|
||||
// Open complies with the fs.FS interface.
|
||||
func (dir RealFS) Open(name string) (fs.File, error) {
|
||||
func (dir realFS) Open(name string) (fs.File, error) {
|
||||
f, err := os.Open(name)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -163,7 +163,7 @@ func Test_pkgDir(t *testing.T) {
|
||||
|
||||
interp := &Interpreter{
|
||||
opt: opt{
|
||||
filesystem: &RealFS{},
|
||||
filesystem: &realFS{},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ func Test_previousRoot(t *testing.T) {
|
||||
} else {
|
||||
rootPath = vendor
|
||||
}
|
||||
p, err := previousRoot(&RealFS{}, rootPath, test.root)
|
||||
p, err := previousRoot(&realFS{}, rootPath, test.root)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user