Sprig is a library that is used to define Go templating functions. The library includes many functions that extend the functionality of Go's templating language. The Sprig library has a few principles that help determine which functions are available to drive enhanced templates:
- Only allows simple math
- Only deals with data that is passed to templates; never retrieves data from an external source
- Utilizes functions from the template library to build the resulting layout
- Never overrides the Go core template functionality
In the following subsections, we'll take a closer look at Sprig's functionality.