diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-09 14:36:26 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2018-08-09 14:36:26 +1000 |
commit | ace85445129576b7eccbe3bb0954bb955d2d6f49 (patch) | |
tree | 7ddcd3d052c186193e74a32f2cd67b3330a391b5 /main.go | |
parent | 4832d365f1a2067c3bc464ec07b19f343ee4c495 (diff) |
create log if debugging and the file doesn't already exist
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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() |