Files
mgmt/lang/interpret_test/TestAstFunc2/unify-template.txtar
James Shubin 29eebd0d07 lang: core: Move template to golang namespace
I don't think this template function should be in any way authoritative,
so let's namespace it.
2024-09-13 15:51:24 -04:00

15 lines
498 B
Plaintext

-- main.mcl --
import "golang"
import "sys"
$tmplvalues = struct{num => 42, load => $theload,}
$theload bool = sys.load()->x1 # wrong type, make sure the compiler catches it!
file "/tmp/datetime" {
state => $const.res.file.state.exists,
content => golang.template("num: {{ .num }} seconds\nload average: {{ .load }}\n", $tmplvalues),
}
-- OUTPUT --
# err: errUnify: error setting type: func() { <built-in:_struct_lookup> }, error: field x1 type error: base kind does not match (bool != float)