Skip to content

Instantly share code, notes, and snippets.

@kenjiskywalker
Created August 12, 2016 13:00
Show Gist options
  • 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{"おれです", "[email protected]"}
var b bytes.Buffer
tpl, _ := template.ParseFiles("personal_data.tmpl")
tpl.Execute(&b, p)
fmt.Println(b.String())
// Name: おれです
// Mail: [email protected]
}
Name: {{ .Name }}
Mail: {{ .Mail }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment