workspace

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRoot = "default"

Variables

View Source
var (
	ErrUnknownRoot = errors.New("unknown workspace root")
	ErrTraversal   = errors.New("path traversal is not allowed")
	ErrPathEscape  = errors.New("path escapes workspace root")
)

Functions

This section is empty.

Types

type Roots

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

Roots resolves paths against a fixed set of canonical workspace roots.

func New

func New(defaultRoot string, namedRoots map[string]string) (*Roots, error)

New creates a root set. An empty defaultRoot uses the current working directory.

func (*Roots) FS

func (r *Roots) FS(name string) (fs.FS, error)

FS returns a read-only file system confined to the named root.

func (*Roots) ResolveRead

func (r *Roots) ResolveRead(name, path string) (string, error)

ResolveRead resolves an existing path and verifies its symlink-expanded path remains in the root.

func (*Roots) ResolveWrite

func (r *Roots) ResolveWrite(name, path string) (string, error)

ResolveWrite resolves a possibly new path using its nearest existing ancestor and verifies it remains in the root.

func (*Roots) Root

func (r *Roots) Root(name string) (string, error)

Root returns the canonical absolute path configured for name.

Jump to

Keyboard shortcuts

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