O'Reilly logo

Go Standard Library Cookbook by Radomir Sohlich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

The Go standard library also contains the package for templating the content. The packages html/template and text/template provide the functions to parse the templates and use them to create the output. The parsing is done with the ParseXXX functions or the methods of the newly-created Template struct pointer. The preceding example uses the ParseFiles function of the html/template package.

The templates themselves are text-based documents or pieces of text which contain dynamic variables. The use of the template is based on merging the template text with the structure that contains the values for the variables present in the template. For merging the template with such structures, the Execute and ExecuteTemplate methods are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required