Skip to content

Commit

Permalink
修复配置文件问题
Browse files Browse the repository at this point in the history
  • Loading branch information
happy888888 committed Dec 26, 2020
1 parent 5b664e8 commit 57ce9aa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/WeiboTask/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func LoadConfig() error {
// @param path string 配置文件路径(需要写入权限)
// @return
func SaveConfig() error {
f, err := os.OpenFile(ConfigPath, os.O_WRONLY|os.O_CREATE,0600)
f, err := os.OpenFile(ConfigPath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC,0600)
if err != nil {
return err
}
Expand All @@ -68,6 +68,6 @@ func SaveConfig() error {
}
var str bytes.Buffer
_ = json.Indent(&str, s, "", " ")
_, err = f.Write([]byte(str.String()))
_, err = f.Write(str.Bytes())
return err
}

0 comments on commit 57ce9aa

Please sign in to comment.