embedded

package
v0.0.0-...-328360e Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package embedded embeds mcl modules into the system import namespace. Typically these are made available via an `import "embedded/foo"` style stmt.

Index

Constants

View Source
const (
	// Scheme is the string used to represent the scheme used by the
	// embedded filesystem URI.
	Scheme = "embeddedfs"
)

Variables

This section is empty.

Functions

func FullModuleName

func FullModuleName(moduleName string) string

FullModuleName is a helper function that returns the embedded module name. This is the parent directory that an embedded code base should use as prefix.

func Lookup

func Lookup(module string) (engine.Fs, error)

Lookup pulls out an embedded filesystem module which will contain a valid URI method. The returned fs is read-only. XXX: Update the interface to remove the afero part leaving this all read-only

func MergeFS

func MergeFS(filesystems ...fs.ReadFileFS) fs.ReadFileFS

MergeFS merges multiple filesystems and returns an fs.FS. It is provided as a helper function to abstract away the underlying implementation in case we ever wish to replace it with something more performant or ergonomic. TODO: add a new interface that combines ReadFileFS and ReadDirFS and use that as the signature everywhere so we could catch those issues at the very start!

func ModuleRegister

func ModuleRegister(module string, fs fs.ReadFileFS)

ModuleRegister takes a filesystem and stores a reference to it in our embedded module system along with a name. Future lookups to that name will pull out that filesystem.

Types

This section is empty.

Jump to

Keyboard shortcuts

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