Documentation
¶
Overview ¶
Package vfsafero provides a compatibility later between github.com/twpayne/go-vfs and github.com/spf13/afero.
Index ¶
- type AferoFS
- func (a *AferoFS) Create(name string) (afero.File, error)
- func (a *AferoFS) LstatIfPossible(name string) (os.FileInfo, bool, error)
- func (a *AferoFS) MkdirAll(path string, perm os.FileMode) error
- func (a *AferoFS) Name() string
- func (a *AferoFS) Open(name string) (afero.File, error)
- func (a *AferoFS) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AferoFS ¶
An AferoFS implements github.com/spf13/afero.Fs.
func NewAferoFS ¶
NewAferoFS returns a new AferoFS.
Example ¶
package main
import (
"testing"
"github.com/spf13/afero"
"github.com/twpayne/go-vfs/vfst"
vfsafero "github.com/twpayne/go-vfsafero"
)
func main() {
Test := func(t *testing.T) {
fs, cleanup, err := vfst.NewTestFS(map[string]interface{}{
"/home/user/.bashrc": "# contents of .bashrc\n",
})
if err != nil {
t.Fatal(err)
}
defer cleanup()
aferoFS := vfsafero.NewAferoFS(fs)
afero.WriteFile(aferoFS, "/home/user/foo", []byte("bar"), 0666)
vfst.RunTests(t, fs, "",
vfst.TestPath("/home/user/foo",
vfst.TestContentsString("bar"),
),
)
}
Test(&testing.T{})
}
Output:
func (*AferoFS) LstatIfPossible ¶
LstatIfPossible implements afero.Lstater.LstatIfPossible.
Click to show internal directories.
Click to hide internal directories.