Skip to content

Instantly share code, notes, and snippets.

@miku
Last active December 6, 2015 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miku/87a9345650a50ccf848e to your computer and use it in GitHub Desktop.
Save miku/87a9345650a50ccf848e to your computer and use it in GitHub Desktop.
package main
import (
"os"
"text/template"
)
type Inventory struct {
Material string
Count uint
}
func main() {
sweaters := Inventory{"wool", 17}
tmpl, err := template.New("test").Parse("{{.Count}} items are made of {{.Material}}")
if err != nil {
panic(err)
}
err = tmpl.Execute(os.Stdout, sweaters)
if err != nil {
panic(err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment