Help us shape the future of Go! Take the 2026 Go Developer Survey

mountfs

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package mountfs implements a mount-table FileSystem composed of one or more child FileSystems mounted at virtual paths over a base FS.

Each public method resolves the requested path to the longest-prefix mount, translates the path into the child's namespace, and forwards the call. Cross-mount Rename and Link fall back to copy+delete.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	// contains filtered or unexported fields
}

FS is the composed FileSystem.

func New

func New(opts Options) (*FS, error)

New constructs an FS.

func (*FS) AllPaths

func (f *FS) AllPaths() []string

func (*FS) AppendFile

func (f *FS) AppendFile(name string, data []byte, perm os.FileMode) error

func (*FS) Chmod

func (f *FS) Chmod(name string, mode os.FileMode) error

func (*FS) Chtimes

func (f *FS) Chtimes(name string, atime, mtime time.Time) error

func (*FS) Create

func (f *FS) Create(name string) (gobashfs.File, error)
func (f *FS) Link(oldpath, newpath string) error

func (*FS) Lstat

func (f *FS) Lstat(name string) (os.FileInfo, error)

func (*FS) Mkdir

func (f *FS) Mkdir(name string, perm os.FileMode) error

func (*FS) MkdirAll

func (f *FS) MkdirAll(name string, perm os.FileMode) error

func (*FS) Mount

func (f *FS) Mount(path string, child gobashfs.FileSystem) error

Mount adds a child FileSystem at path. The path is cleaned; an empty or root path means the child replaces the base (rejected here — use Options.Base instead).

func (*FS) Open

func (f *FS) Open(name string) (iofs.File, error)

func (*FS) OpenFile

func (f *FS) OpenFile(name string, flag int, perm os.FileMode) (gobashfs.File, error)

func (*FS) ReadDir

func (f *FS) ReadDir(name string) ([]iofs.DirEntry, error)

func (*FS) ReadFile

func (f *FS) ReadFile(name string) ([]byte, error)
func (f *FS) Readlink(name string) (string, error)

func (*FS) Realpath

func (f *FS) Realpath(name string) (string, error)

func (*FS) Remove

func (f *FS) Remove(name string) error

func (*FS) RemoveAll

func (f *FS) RemoveAll(name string) error

func (*FS) Rename

func (f *FS) Rename(oldpath, newpath string) error

Rename moves oldpath to newpath. If the two paths route to the same child FS, the child's Rename is delegated; otherwise copy+delete.

func (*FS) Stat

func (f *FS) Stat(name string) (os.FileInfo, error)
func (f *FS) Symlink(target, linkpath string) error

func (*FS) Unmount

func (f *FS) Unmount(path string) error

Unmount removes a child FileSystem at path.

func (*FS) WriteFile

func (f *FS) WriteFile(name string, data []byte, perm os.FileMode) error

type Mount

type Mount struct {
	Path       string
	FileSystem gobashfs.FileSystem
}

Mount associates a virtual mount point with a child FileSystem.

type Options

type Options struct {
	Base   gobashfs.FileSystem
	Mounts []Mount
}

Options configures an FS instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL