1
1
mirror of https://github.com/mcuadros/ascode synced 2024-11-23 01:11:59 +01:00

runtime: add struct support

This commit is contained in:
Máximo Cuadros 2020-03-17 00:45:27 +01:00
parent fdaa5673f6
commit 79f0e8a22d
No known key found for this signature in database
GPG Key ID: 17A5DFEDC735AE4B

@ -17,6 +17,7 @@ import (
"go.starlark.net/repl"
"go.starlark.net/resolve"
"go.starlark.net/starlark"
"go.starlark.net/starlarkstruct"
)
func init() {
@ -39,6 +40,7 @@ func NewRuntime(pm *terraform.PluginManager) *Runtime {
modules: map[string]LoadModuleFunc{
filepath.ModuleName: filepath.LoadModule,
os.ModuleName: os.LoadModule,
docker.ModuleName: docker.LoadModule,
"encoding/json": json.LoadModule,
"encoding/base64": base64.LoadModule,
@ -46,14 +48,13 @@ func NewRuntime(pm *terraform.PluginManager) *Runtime {
"encoding/yaml": yaml.LoadModule,
"re": re.LoadModule,
"http": http.LoadModule,
"experimental/docker": docker.LoadModule,
},
predeclared: starlark.StringDict{
"provider": types.BuiltinProvider(pm),
"provisioner": types.BuiltinProvisioner(pm),
"backend": types.BuiltinBackend(),
"hcl": types.BuiltinHCL(),
"struct": starlark.NewBuiltin("struct", starlarkstruct.Make),
},
}
}