blob: bc7f6da5a4f8551cb2f4dc13eea15b737af16b52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
package fossil
import (
_ "embed"
"go.nc0.fr/svgu/pkg/config/lib/prelude"
"go.starlark.net/starlark"
"go.starlark.net/starlarkstruct"
"sync"
)
var (
once = sync.Once{}
fossil = starlark.StringDict{}
//go:embed fossil.star
fossilFile string
fossilErr error
)
// LoadFossilModule loads the Fossil module.
func LoadFossilModule(t *starlark.Thread) (starlark.StringDict, error) {
once.Do(func() {
env := starlark.StringDict{
"module": starlark.NewBuiltin("module",
prelude.InternModule),
"make_module": starlark.NewBuiltin("mod",
starlarkstruct.MakeModule),
}
fossil, fossilErr = starlark.ExecFile(t, "fossil.star", fossilFile, env)
})
return fossil, fossilErr
}
|