diff --git a/docs/faq.md b/docs/faq.md index f3d7460b..511eb8b5 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -254,6 +254,13 @@ prevent masking an error for a situation when you expected a file to already be at that location. It also turns out to simplify the internals significantly, and remove an ambiguous scenario with the reversable file resource. +### Why do function names inside of templates include underscores? + +The golang template library which we use to implement the template() function +doesn't support the dot notation, so we import all our normal functions, and +just replace dots with underscores. As an example, the standard `datetime.print` +function is shown within mcl scripts as datetime_print after being imported. + ### On startup `mgmt` hangs after: `etcd: server: starting...`. If you get an error message similar to: diff --git a/examples/lang/datetime1.mcl b/examples/lang/datetime1.mcl index fee9f0eb..798ccb4b 100644 --- a/examples/lang/datetime1.mcl +++ b/examples/lang/datetime1.mcl @@ -5,3 +5,7 @@ file "/tmp/mgmt/datetime" { state => $const.res.file.state.exists, content => template("Hello! It is now: {{ datetime_print . }}\n", $d), } + +file "/tmp/mgmt/" { + state => $const.res.file.state.exists, +}