Last active
December 6, 2015 13:39
-
-
Save miku/87a9345650a50ccf848e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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