handle marshal error
This commit is contained in:
parent
91110c5e02
commit
4a76e28559
|
@ -20,12 +20,12 @@ func (h *Config) Create() bool{
|
||||||
var config = Check(h.App_file)
|
var config = Check(h.App_file)
|
||||||
if config[0] == false {
|
if config[0] == false {
|
||||||
if w, err := os.Create(h.App_file); err == nil {
|
if w, err := os.Create(h.App_file); err == nil {
|
||||||
|
defer w.Close()
|
||||||
y, err := yaml.Marshal(&h)
|
y, err := yaml.Marshal(&h)
|
||||||
w.WriteString(string(y))
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
defer panic(err)
|
defer panic(err)
|
||||||
}
|
}
|
||||||
w.Close()
|
w.WriteString(string(y))
|
||||||
return true
|
return true
|
||||||
}else{
|
}else{
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
Loading…
Reference in New Issue