From 4a76e28559d88ad9a969b9cceb9b82a18d2e59e1 Mon Sep 17 00:00:00 2001 From: alessio Date: Tue, 12 Jul 2016 12:16:32 +0200 Subject: [PATCH] handle marshal error --- realize/config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/realize/config.go b/realize/config.go index ab46e2e..e881d30 100644 --- a/realize/config.go +++ b/realize/config.go @@ -20,12 +20,12 @@ func (h *Config) Create() bool{ var config = Check(h.App_file) if config[0] == false { if w, err := os.Create(h.App_file); err == nil { + defer w.Close() y, err := yaml.Marshal(&h) - w.WriteString(string(y)) if err != nil { defer panic(err) } - w.Close() + w.WriteString(string(y)) return true }else{ panic(err)