fix code quality issue
This commit is contained in:
parent
d54992b71e
commit
3a3e70ea01
18
cmd/utils.go
18
cmd/utils.go
@ -62,24 +62,20 @@ type pythonData struct {
|
|||||||
|
|
||||||
func dbExists(path string) (bool, error) {
|
func dbExists(path string) (bool, error) {
|
||||||
stat, err := os.Stat(path)
|
stat, err := os.Stat(path)
|
||||||
|
if err == nil {
|
||||||
|
return stat.Size() != 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
d := filepath.Dir(path)
|
d := filepath.Dir(path)
|
||||||
_, err = os.Stat(d)
|
_, err = os.Stat(d)
|
||||||
if !os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return false, err
|
os.MkdirAll(d, 0700)
|
||||||
|
return false, nil
|
||||||
}
|
}
|
||||||
os.MkdirAll(d, 0700)
|
|
||||||
return false, nil
|
|
||||||
} else if err != nil {
|
|
||||||
return false, err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if stat.Size() == 0 {
|
return false, err
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return true, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
|
func python(fn pythonFunc, cfg pythonConfig) cobraFunc {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user