From e1f81c1f57ce234b8b25239d3b7c94bb26a4824b Mon Sep 17 00:00:00 2001 From: boypt <1033514+boypt@users.noreply.github.com> Date: Mon, 23 Dec 2019 15:52:47 +0800 Subject: [PATCH] fix config readerr --- engine/config.go | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/engine/config.go b/engine/config.go index 2684c0b1a..c39a8efb1 100644 --- a/engine/config.go +++ b/engine/config.go @@ -6,6 +6,7 @@ import ( "errors" "io/ioutil" "log" + "os" "reflect" "strings" @@ -105,11 +106,13 @@ func (c *Config) SaveConfigFile(configPath string) error { ob, err := ioutil.ReadFile(configPath) if err != nil { - return err - } - - if bytes.Compare(b, ob) == 0 { - return nil + if !os.IsNotExist(err) { + return err + } + } else { + if bytes.Compare(b, ob) == 0 { + return nil + } } return ioutil.WriteFile(configPath, b, 0644)