Skip to content

Instantly share code, notes, and snippets.

@kenjiskywalker
Created August 12, 2016 13:00
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 kenjiskywalker/95b5ef60ac2ae5c2f07946c49c5a9a04 to your computer and use it in GitHub Desktop.
Save kenjiskywalker/95b5ef60ac2ae5c2f07946c49c5a9a04 to your computer and use it in GitHub Desktop.
package main
import (
"bytes"
"fmt"
"html/template"
)
func main() {
type PersonalData struct {
Name string
Mail string
}
p := PersonalData{"おれです", "ore@example.com"}
var b bytes.Buffer
tpl, _ := template.ParseFiles("personal_data.tmpl")
tpl.Execute(&b, p)
fmt.Println(b.String())
// Name: おれです
// Mail: ore@example.com
}
Name: {{ .Name }}
Mail: {{ .Mail }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment