Documentation
¶
Overview ¶
Package file confines file tools to a root and applies a caller-supplied write policy.
Index ¶
- Variables
- func InGitDir(name string) bool
- func RefuseGitDir(name string) error
- type Root
- func (self *Root) FS() fs.FS
- func (self *Root) MkdirAll(name string, perm os.FileMode) error
- func (self *Root) Mount(path string, root *Root)
- func (self *Root) Name() string
- func (self *Root) Open(name string) (*os.File, error)
- func (self *Root) ReadFile(name string) ([]byte, error)
- func (self *Root) RefuseWrite(name string) error
- func (self *Root) Resolve(path string) (*Root, string, error)
- func (self *Root) Stat(name string) (os.FileInfo, error)
- func (self *Root) WriteFile(name string, data []byte, perm os.FileMode) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrGitDir = errors.New("refusing to touch anything inside a .git directory")
ErrGitDir refuses a change inside a repository's own metadata.
View Source
var ErrOutsideRoot = errors.New("path is outside the root")
ErrOutsideRoot is a path resolving to somewhere the root does not reach.
View Source
var ErrReadOnly = errors.New("the filesystem is read-only")
ErrReadOnly is what a call that would change something gets while writing is withheld.
Functions ¶
func RefuseGitDir ¶
RefuseGitDir returns ErrGitDir for paths containing a .git component.
Types ¶
type Root ¶
type Root struct {
// contains filtered or unexported fields
}
Root is a directory the tools are confined to, and a rule about what may be changed within it.
func (*Root) MkdirAll ¶
MkdirAll makes a directory and every parent it needs, where the rule allows it.
func (*Root) RefuseWrite ¶
RefuseWrite returns the current refusal for a path.
Click to show internal directories.
Click to hide internal directories.