Last Updated: May 22, 2026
The text/template package is Go's built-in engine for turning a template plus some data into a finished string. Order confirmation emails, shipping notifications, plain-text invoices, daily inventory reports, and any other place where the shape of the output is fixed but the values change is the job this package was built for. This chapter walks through how templates work from the smallest action to multi-file template trees, and where the performance cliffs are.