From bb8f1927f2a9d3ab41c9340aa034f6b803f4359c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 15 Jan 2018 20:27:20 +0100 Subject: [PATCH] Return error instead of panic in WriteReader See https://github.com/gohugoio/hugo/issues/4240 --- util.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/util.go b/util.go index 7463887..4f253f4 100644 --- a/util.go +++ b/util.go @@ -20,7 +20,6 @@ import ( "bytes" "fmt" "io" - "log" "os" "path/filepath" "strings" @@ -46,7 +45,7 @@ func WriteReader(fs Fs, path string, r io.Reader) (err error) { err = fs.MkdirAll(ospath, 0777) // rwx, rw, r if err != nil { if err != os.ErrExist { - log.Panicln(err) + return err } } }