mirror of
https://github.com/HDT3213/godis.git
synced 2025-10-06 17:26:52 +08:00
add some unittests and bug fix
This commit is contained in:
@@ -2,22 +2,9 @@ package files
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"mime/multipart"
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
func GetSize(f multipart.File) (int, error) {
|
||||
content, err := ioutil.ReadAll(f)
|
||||
|
||||
return len(content), err
|
||||
}
|
||||
|
||||
func GetExt(fileName string) string {
|
||||
return path.Ext(fileName)
|
||||
}
|
||||
|
||||
func CheckNotExist(src string) bool {
|
||||
_, err := os.Stat(src)
|
||||
|
||||
@@ -26,7 +13,6 @@ func CheckNotExist(src string) bool {
|
||||
|
||||
func CheckPermission(src string) bool {
|
||||
_, err := os.Stat(src)
|
||||
|
||||
return os.IsPermission(err)
|
||||
}
|
||||
|
||||
@@ -36,7 +22,6 @@ func IsNotExistMkDir(src string) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user