I am designing a system that will heavily use text/template processing and I've run into one issue that is going to be a show stopper for me if I can't figure out a way around it.
Execute() on a template will run all of the functions in the template serially. For example, when you run the code below, you can see it output "slept" once every second until it completes after 3 seconds. In this example, the sleep is simulating an RPC call to another process that may take some considerable time (few tenths of a second), but there will be a large number of these calls that could all theoretically run in parallel (ie. there are no data dependencies between them). I'd really like to know a way that I could have the templating engine run all of the functions at once and collect the output, ie. in the example below, the entire program should run in 1 second. package main import ( "text/template" "os" "time" ) var funcMap = template.FuncMap { "sleep": func() string { time.Sleep(1 * time.Second); return "slept" }, } func main() { tmpl, _ := template.New("test").Funcs(funcMap).Parse("{{sleep}} {{sleep}} {{sleep}}") tmpl.Execute(os.Stdout, nil) } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.