From 7a6abff9f9a4adc0391e2b05cb6ecf3c52fafca1 Mon Sep 17 00:00:00 2001 From: Mark McGranaghan Date: Sun, 7 Oct 2012 02:39:16 -0400 Subject: [PATCH] helpers --- tool/build-html.go | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/tool/build-html.go b/tool/build-html.go index 4e5a9b8..3fb95a4 100644 --- a/tool/build-html.go +++ b/tool/build-html.go @@ -175,9 +175,7 @@ func main() { panic("Wrong number of args") } outF, err := os.Create(os.Args[1]) - if err != nil { - panic(err) - } + check(err) ensureCache() fmt.Fprint(outF, ` @@ -190,9 +188,7 @@ func main() { `) indexBytes, err := ioutil.ReadFile("src/index.txt") - if err != nil { - panic(err) - } + check(err) indexLines := strings.Split(string(indexBytes), "\n") indexNames := make([]string, 0) for _, indexLine := range indexLines { @@ -206,13 +202,9 @@ func main() { if (indexName == "title") || (indexName == "contents") || (indexName == "introduction") { sourcePath := "src/" + indexName + "/" + indexName + ".html" sourceBytes, err := ioutil.ReadFile(sourcePath) - if err != nil { - panic(err) - } + check(err) _, err = outF.Write(sourceBytes) - if err != nil { - panic(err) - } + check(err) } else { chapterPath := "src/" + indexName fmt.Fprintf(outF,