DEV Community

loading...
Cover image for Go's Template Package is Pretty Powerful

Go's Template Package is Pretty Powerful

dak425 profile image Donald Feury Originally published at blog.feurious.com Updated on ・1 min read

Code can be found here

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.

Its 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 ya'll think. Any feedback is greatly appreciated.

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

Discussion (0)

pic
Editor guide