Understanding Go Templates

Understanding Go Templates

Go actually has a template package in its standard library, which is pretty sweet. Normally, this is something you see in separate 3rd party libraries or included in full frameworks, such as Laravel or Rails.

It's very powerful too. In addition to injecting your data into templates, you can extend what you can do while processing the data passed into a template by passing in a map of functions.

I once used it to generate the approx. 150 data types that were listed in Mixer's API documentation. That saved me tons of time from writing boilerplate code.

Check it out and let me know what y'all think. Any feedback is greatly appreciated.

Code can be found here

If you liked it and want to know when I post more, be sure to subscribe and thank y'all again for your time!


Did you find this information useful? If so, consider heading over to my donation page and drop me some support.

Want to ask a question or just chat? Contact me here