diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-08-25 14:55:17 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-08-25 14:55:17 +0900 |
| commit | 18ba73c9571f4dbf07a14c980c4bb86d234fa136 (patch) | |
| tree | 41f9c5a0955d986bc9c3fbeda660be6cc35ec677 /internal/rosa/builtins_env.go | |
| parent | 1c3761bb53c95d75751f95e8f77d9d1e5928b968 (diff) | |
internal/rosa: optionally load built-ins from filesystem
This avoids having to rebuild cmd/mbf over and over.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/builtins_env.go')
| -rw-r--r-- | internal/rosa/builtins_env.go | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/internal/rosa/builtins_env.go b/internal/rosa/builtins_env.go new file mode 100644 index 00000000..a125e25f --- /dev/null +++ b/internal/rosa/builtins_env.go @@ -0,0 +1,28 @@ +//go:build penv + +package rosa + +import ( + "io/fs" + "os" +) + +// builtinAzalea is the backing directory of built-in azalea-based [Artifact] +// implementations. +var builtinAzalea = func() fs.FS { + const name = "ROSA_SOURCE" + + pathname, ok := os.LookupEnv(name) + if !ok { + println(name + " not set") + os.Exit(1) + } + + root, err := os.OpenRoot(pathname) + if err != nil { + println(err.Error()) + os.Exit(1) + } + + return root.FS() +}() |
