Go’s Template Package is Pretty Powerful

Donald Feury
1 min readAug 4, 2020

--

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.

Draw me like one of your french gophers

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!

This post is originally from my blog

--

--

Donald Feury
Donald Feury

Written by Donald Feury

Appalachian Boi, Technology Consultant, Content Creator

No responses yet