Skip to content

Instantly share code, notes, and snippets.

@sunfmin
Created March 22, 2013 06:28
Show Gist options
  • Save sunfmin/5219393 to your computer and use it in GitHub Desktop.
Save sunfmin/5219393 to your computer and use it in GitHub Desktop.
package templates
import (
"fmt"
"io"
)
type HelloData struct {
Name string
Email string
Lang string
Entries []*Entry
}
type Entry struct {
Type string
Title string
}
{{func Hello(d *HelloData)}}
<h1>{{fmt.Sprintf("Hi, %s", d.Name)}} {{d.MyEmail()}}</h1>
<ul>
{{ for _, e := range d.Entries }}
<li>{{EntryItem(e, d.Lang)}}</li>
{{ end }}
</ul>
{{end}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment