I completely agree. The go templating language is a nightmare. I probably learned most when dealing with Helm, but I've always been holding out hoping that something better would replace it.
Does anyone know why the templating situation is the way it is in go? In many other languages you have multiple competing templating languages, but in go this is basically what you get. Are there language specific features that make it hard?
EDIT: interesting to final see active liquid templating engines for go. now if only legacy would allow for the use of these things.
My opinion is that helm does the completely wrong thing: patching text. It should instead patch objects, so that we don’t have to deal with indentation and other silly things.
I'm completely with you. Generating a data structure using a text templating language is just awkward and error prone. In fact I'm starting to think that text templates are very rarely the best option. It is usually better to have a proper emitter library or AST data structure that can be generated with "real" code.
I guess one of the few places that text templates can provide value is when the template is untrusted. But maybe a sandboxed programming language is still a better option here.