Closed yngvark closed 3 months ago
Huh, very weird. I think there's something happening where the {
and }
at the beginning/ending of the file are causing issues. It seems like it should work, so I'm not sure why that's the case, but while we investigate, the workaround is to "escape" those curly braces:
{{"{"}}
"foo" : "{{ .Foo }}"
{{"}"}}
I can also confirm that with totally standalone Go template, this rendering should work:
package main
import (
"os"
"text/template"
)
const json = `{
"foo": "{{ .Foo }}"
}`
func main() {
tmpl, err := template.New("test").Parse(json)
if err != nil {
panic(err)
}
err = tmpl.Execute(os.Stdout, map[string]string{"Foo": "bar"})
if err != nil {
panic(err)
}
}
The output from running this is:
{
"foo": "bar"
}
@denis256 When you have a chance, could you take a look?
Will take a look soon
Fix included in https://github.com/gruntwork-io/boilerplate/releases/tag/v0.5.12
Describe the bug
The template
renders as an exact copy, without "Foo" being replaced by any input variable.
To Reproduce
Expected behavior
I expect the file
../output/example1.json
to containbut it contains:
The template in
example1.json
works fine here: https://gotemplate.io.Nice to have
Additional context
boilerplate version v0.5.11