From 2895462bca58cefa01789fcedbb568ff7f417103 Mon Sep 17 00:00:00 2001 From: "Serge A. Zaitsev" Date: Fri, 5 Dec 2014 19:26:59 +0200 Subject: [PATCH] moved eval func type to the top, added some error logs --- zs.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/zs.go b/zs.go index e9c3b01..12cddbd 100644 --- a/zs.go +++ b/zs.go @@ -21,6 +21,8 @@ const ( PUBDIR = ".pub" ) +type EvalFn func(args []string, vars map[string]string) (string, error) + func split2(s, delim string) (string, string) { parts := strings.SplitN(s, delim, 2) if len(parts) == 2 { @@ -43,8 +45,6 @@ func md(s string) (map[string]string, string) { return v, body } -type EvalFn func(args []string, vars map[string]string) (string, error) - func render(s string, vars map[string]string, eval EvalFn) (string, error) { b := []byte(s) delim_open := []byte("{{") @@ -228,7 +228,7 @@ func main() { buildAll(false) // pass duration case "var": if len(args) == 0 { - // print error + log.Println("ERROR: filename expected") return } if b, err := ioutil.ReadFile(args[0]); err == nil { @@ -244,7 +244,7 @@ func main() { } } } else { - // print error + log.Println(err) } default: cmd := exec.Command(path.Join(ZSDIR, cmd), args...) -- 2.43.0