handle marshal error

This commit is contained in:
alessio 2016-07-12 12:16:32 +02:00
parent 91110c5e02
commit 4a76e28559
1 changed files with 2 additions and 2 deletions

View File

@ -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)