This commit is contained in:
Unknown
2013-05-07 23:43:09 -04:00
parent 9f0b4ae8c1
commit ffca9f3c2b
97 changed files with 7353 additions and 57 deletions

View File

@@ -0,0 +1,23 @@
// template_field.go
package main
import (
"fmt"
"os"
"text/template"
)
type Person struct {
Name string
nonExportedAgeField string
}
func main() {
t := template.New("hello")
t, _ = t.Parse("hello {{.Name}}!")
p := Person{Name:"Mary", nonExportedAgeField: "31"}
if err := t.Execute(os.Stdout, p); err != nil {
fmt.Println("There was an error:", err.Error())
}
}
// Output: hello Mary!