Hey everyone,
I have a use case where I'm allowing users to create templates that can have certain variables (e.g. {{.FirstName}}). Think of it like a mailing application.
I'm currently using text/template. The problem I'm running into is that many users mistakenly use incorrect template variables (missing a ".", or using something that isn't in their data model passed to the template, etc.). These users are *not* Go devs. Their' just normal users, so they don't know the in's and outs of templating.
From what I've read, there doesn't appear to be much in the way of error handling with templates. For example, if the user forgets a ".", the app crashes. The same goes for if the user tries to use a value that isn't there.
Since this simple find/replacing is the only thing I'm using templates for, would it be safer just to use strings.Replace, or would that be unidiomatic?
Any help is greatly appreciated!
Jordan