/go-templating

GoLang Templating Made Easy

Primary LanguageGoMIT LicenseMIT

GoLang Templating Made Easy

This is an example repo I cooked up to show how to use Golang's text/template package.

It is meant to be followed using my Medium blog post.

To run the examples:

  • Make sure you have go-lang installed
  • Clone this repo
  • Cd into an example
  • Run go run zoo.go

Each example contains:

  • zoo.go: containing the actual logic for generating the template
  • zoo.tmpl: contains the template

The examples consist of:

  • Example 1: Creating a Template from a Golang Object
  • Example 2: Creating a Template Function
  • Example 3: Creating a Sub-Template

Note: Each example builds off the previous.

Thanks for checking it out!!