aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/rosa.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-08-25 13:57:38 +0900
committerOphestra <cat@gensokyo.uk>2026-08-25 14:00:42 +0900
commitac7abbbe3fa2eea01defb670abc7dc1dc336cf21 (patch)
treecb8c451110acbd394667e94ae66c53dc422398b8 /internal/rosa/rosa.go
parent7ee5d5368de5494350e7766a595c2bdc8f01ce80 (diff)
internal/rosa: read-only access to built-ins
This removes potential footguns caused by mutable builtins without requiring unnecessary clones. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/rosa.go')
-rw-r--r--internal/rosa/rosa.go16
1 files changed, 4 insertions, 12 deletions
diff --git a/internal/rosa/rosa.go b/internal/rosa/rosa.go
index 32c1bd00..1089ffa1 100644
--- a/internal/rosa/rosa.go
+++ b/internal/rosa/rosa.go
@@ -624,33 +624,25 @@ func (attr *GenericHelper) script(t Toolchain, _ string) string {
return script
}
-// native contains natively-implemented and built-in azalea-based [Artifact].
-// It is generally recommended to clone this instance for custom [Artifact]
-// registrations.
-var native S
-
-// Native returns the global [S].
-func Native() *S { return &native }
-
// parseTime is the duration of early parsing of built-in azalea expressions.
var parseTime time.Duration
// ParseTime returns the time taken by early parsing of built-in azalea expressions.
func ParseTime() time.Duration { return parseTime }
-// nativeB is the backing directory of built-in azalea-based [Artifact]
+// builtinAzalea is the backing directory of built-in azalea-based [Artifact]
// implementations.
//
//go:embed package
-var nativeB embed.FS
+var builtinAzalea embed.FS
func init() {
- sub, err := fs.Sub(nativeB, "package")
+ sub, err := fs.Sub(builtinAzalea, "package")
if err != nil {
panic(err)
}
t := time.Now()
- if err = native.RegisterFS(sub); err != nil {
+ if err = builtin.RegisterFS(sub); err != nil {
println(err.Error())
os.Exit(1)
}