interp: do not export RealFS, used internally only

This commit is contained in:
Marc Vertes
2021-09-15 16:22:07 +02:00
committed by GitHub
parent 5af51aefe6
commit b591ba0e78
3 changed files with 6 additions and 6 deletions

View File

@@ -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(),

View File

@@ -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

View File

@@ -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)
}