<!-- A Tutorial for the Go Programming Language -->
+<!--
+ DO NOT EDIT: created by
+ tmpltohtml go_tutorial.tmpl
+-->
+
+
<h2>Introduction</h2>
<p>
This document is a tutorial introduction to the basics of the Go programming
os.Exit(2)
}
+var templateFuncs = template.FuncMap{
+ "code": code,
+ "donotedit": donotedit,
+}
+
func main() {
flag.Usage = Usage
flag.Parse()
// Read and parse the input.
name := flag.Args()[0]
- tmpl := template.New(name).Funcs(template.FuncMap{"code": code})
+ tmpl := template.New(name).Funcs(templateFuncs)
if _, err := tmpl.ParseFiles(name); err != nil {
log.Fatal(err)
}
return ""
}
+func donotedit() string {
+ // No editing please.
+ return fmt.Sprintf("<!--\n DO NOT EDIT: created by\n tmpltohtml %s\n-->\n", flag.Args()[0])
+}
+
func code(file string, arg ...interface{}) (string, error) {
text := contents(file)
var command string