Constructing HTML output

This section illustrates the use of the html/template package with an example named htmlT.go. It will be presented in six parts. The philosophy of the html/template package is the same as the text/template package. The main difference between these two packages is that html/template generates HTML output that is safe against code injection.

Although you can create HTML output with the text/template package – after all, HTML is just plain text – if you want to create HTML output, then you should use the html/template package instead.

For reasons of simplicity, the following presented will read data from an SQLite database, but you can use any database that you want, provided that you have or you can write the appropriate ...

Get Mastering Go - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.