Closed mingwho closed 4 years ago
Hi @mingwho, thanks for opening this!
I've tried what you described, adding to test.twig
:
{% if 1 == 1 %}
1 equals 1
{% endif %}
and to main.go
:
package main
import (
"os"
"github.com/tyler-sommer/stick"
)
func main() {
fsRoot, _ := os.Getwd()
env := stick.New(stick.NewFilesystemLoader(fsRoot))
p := map[string]stick.Value{"name": "World"}
err := env.Execute("test.twig", os.Stdout, p)
if err != nil {
panic(err)
}
}
When I run it, I get the expected output:
$ go run main.go
1 equals 1
In your example, it appears like you may not be handling the possible error returned by env.Execute
. Can you confirm that the error is nil?
Oh my! Thanks for pointing this out. I edited some code in the library on my local env and it was causing an error, but I didn't see it. THANK YOU! It's working proper
Say if we have a file test.twig like following
Our script to render this template is as following
It should print "1 equals 1", but right now it is not printing anything. Did I miss something here or is this a bug we need to fix?