Skip to content

Commit

Permalink
✨ 添加文件安全写入函数
Browse files Browse the repository at this point in the history
  • Loading branch information
88250 committed May 19, 2021
1 parent 9407279 commit 83a6164
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"io"
"io/ioutil"
"os"
"path"
"path/filepath"
"strings"
)
Expand All @@ -23,7 +22,7 @@ import (
func (GuluFile) WriteFileSafer(writePath string, data []byte, perm os.FileMode) error {
// credits: https://github.com/vitessio/vitess/blob/master/go/ioutil2/ioutil.go

dir, name := path.Split(writePath)
dir, name := filepath.Split(writePath)
f, err := ioutil.TempFile(dir, name)
if nil != err {
return err
Expand Down

0 comments on commit 83a6164

Please sign in to comment.