I was puzzled by something you said earlier: > The template is the only entity that knows exactly which data from the data set is needed.
You've just given a bit more information, but I still don't quite understand. You have some C code that you don't control and it's producing some information. You have some Go which is executing a template. You say that the template has access to some data that the rest of the Go application doesn't have. A template is really just a function expressed in a rather opaque language. The Go application invokes this function by calling the execute method, passing a destination and some data. The function glues together the text in the template and the data, creates a piece of text and sends it to the destination. While it is doing that, it can call other functions, so if it has a piece of data that the rest of the application doesn't have, it can call a function to hand it back. Fundamentally, the template is part of your Go application, it's just expressed in a cranky language that was only ever designed to describe how to render some text. So I don't understand how your template can be holding a piece of data that the rest of the application can't get at. That cranky language is the reason why lots of people think what you are doing is a bad idea. The conventional wisdom is that a template should be very simple. You should do as much processing as possible in Go before you call the template, and pass the results to the template as data. Your application will be much easier to maintain if you do that. Put simply, if your template code can get hold of some data, I don't understand why your Go code can't get hold of the same data, given that the template code and the Go are part of the same application. If this is an HTTP client/server system, the template produces an HTTP response, perhaps some HTML, and sends to a web browser to be rendered. The web browser could be holding some data that the application doesn't have, but that's not the template, it's the client, and there are lots of ways to get data from a client to a server. Can you explain the problem you have in a bit more detail? -- 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.