package main import ( "bytes" "encoding/json" "fmt" "os" "os/exec" "text/template" ) //const statsPath = "/home/vilmibm/bin/townstats" const statsPath = "/town/bin/stats" type newsEntry struct { Title string `json:"title"` // Title of entry Pubdate string `json:"pubdate"` // Human readable date Content string `json:"content"` // HTML of entry } type tildeData struct { News []newsEntry `json:"news"` // Collection of town news entries } func _main() error { data, err := stats() if err != nil { return err } hypertextDocument := getHeader() for _, entry := range data.News { entryHTML, err := renderEntry(entry) if err != nil { return err } hypertextDocument += entryHTML } hypertextDocument += getFooter() fmt.Println(hypertextDocument) return nil } func renderEntry(entry newsEntry) (string, error) { t, err := template.New("news").Parse(`