I am looking for simple method to convert simple template with ${myvar}
to GO template with {{ myvar }}
.
Is there any library to achieve that?
I am looking for simple method to convert simple template with ${myvar}
to GO template with {{ myvar }}
.
Is there any library to achieve that?
You can actually configure your own delimiters. See here: https://golang.org/pkg/text/template/#Template.Delims
So, you should be able to configure prefix as "${" and suffix as "}". Then you should be able to keep using ${myvar} format.
If you prefer to use a regexp to find and replace them, then you regexp should be a little bit more complicated. At the very least it should allow spaces and dots in addition to those proposed. But I'd suggest investigating non greedy replacements instead. See here for an example.