Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Documentation and the go templating language. I just don’t find it readable. Here’s an example from the docs

  {{ if (and (or (isset .Params "title") (isset .Params "caption")) (isset .Params "attr")) }}


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.


> I probably learned most when dealing with Helm,

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 don’t think it’ll ever change though :(


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.


pango2 is another one I see mentioned occasionally.

https://github.com/flosch/pongo2


This project uses another templating language, apparently based on Shopify's liquid like Jekyll.

(1) https://github.com/osteele/liquid




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: