From ace85445129576b7eccbe3bb0954bb955d2d6f49 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Thu, 9 Aug 2018 14:36:26 +1000 Subject: [PATCH] create log if debugging and the file doesn't already exist --- main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 3b965b8ac..cd0ba0e87 100644 --- a/main.go +++ b/main.go @@ -62,7 +62,10 @@ func localLog(colour color.Attribute, path string, objects ...interface{}) { if !*debuggingFlag { return } - f, _ := os.OpenFile(projectPath(path), os.O_APPEND|os.O_WRONLY, 0644) + f, err := os.OpenFile(projectPath(path), os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644) + if err != nil { + panic(err.Error()) + } defer f.Close() for _, object := range objects { colorFunction := color.New(colour).SprintFunc()