From 0b7f751f6001926f00189139eb2ee2da8eb2b6f6 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 11 Jun 2019 22:54:07 +0300 Subject: [PATCH] lib/fs: use filepath.Dir instead of filepath.Split, since the filename is unused --- lib/fs/fs.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/fs/fs.go b/lib/fs/fs.go index 8a5ba51d8..adda41301 100644 --- a/lib/fs/fs.go +++ b/lib/fs/fs.go @@ -113,7 +113,7 @@ func WriteFile(path string, data []byte) error { if err != nil { return fmt.Errorf("cannot obtain absolute path to %q: %s", path, err) } - parentDirPath, _ := filepath.Split(absPath) + parentDirPath := filepath.Dir(absPath) SyncPath(parentDirPath) return nil @@ -191,7 +191,8 @@ func IsPathExist(path string) bool { // and syncs the parent directory, so it no longer contains the path. func MustRemoveAllSynced(path string) { MustRemoveAll(path) - SyncPath(filepath.Dir(path)) + parentDirPath := filepath.Dir(path) + SyncPath(parentDirPath) } // MustRemoveAll removes path with all the contents.