Skip to content

Instantly share code, notes, and snippets.

@gregworley
Created October 7, 2011 20:48
Show Gist options
  • Save gregworley/1271317 to your computer and use it in GitHub Desktop.
Save gregworley/1271317 to your computer and use it in GitHub Desktop.
Golang's New Template pkg
package main
import ("template" ;"os")
const templ = `Hello {{.Name}}`
type Person struct {Name string}
func main() {
me := &Person{Name: "greg"}
var t = template.Must(template.New("first").Parse(templ))
t.Execute(os.Stdout, me)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment