Skip to content

Commit 24d031d

Browse files
committed
feat: clear temp file while start
1 parent 7141bf0 commit 24d031d

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

bootstrap/conf.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
log "github.com/sirupsen/logrus"
88
"io/ioutil"
99
"os"
10+
"path/filepath"
1011
)
1112

1213
// InitConf init config
@@ -46,7 +47,11 @@ func InitConf() {
4647
if !conf.Conf.Force {
4748
confFromEnv()
4849
}
49-
err := os.MkdirAll(conf.Conf.TempDir, 0700)
50+
err := os.RemoveAll(filepath.Join(conf.Conf.TempDir))
51+
if err != nil {
52+
log.Errorln("failed delete temp file:", err)
53+
}
54+
err = os.MkdirAll(conf.Conf.TempDir, 0700)
5055
if err != nil {
5156
log.Fatalf("create temp dir error: %s", err.Error())
5257
}

0 commit comments

Comments
 (0)