This repository has been archived on 2019-06-27. You can view files and clone it, but cannot push or open issues/pull-requests.
am/cmd/generate/templates.go

29 lines
505 B
Go

package main
import (
"io/ioutil"
"path/filepath"
"strings"
)
func main() {
paths, err := filepath.Glob("templates/*")
if err != nil {
panic(err)
}
contents := []string{}
for _, path := range paths {
data, err := ioutil.ReadFile(path)
if err != nil {
panic(err)
}
contents = append(contents, string(data))
}
s := "package am\n\nvar tmpls = `\n" + strings.Join(contents, "\n") + "\n`\n"
if err := ioutil.WriteFile("tmpl_gen.go", []byte(s), 0644); err != nil {
panic(err)
}
}