mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🔥 移除 IsValidJSON 函数
This commit is contained in:
parent
aefd86ce78
commit
49e5143de8
1 changed files with 0 additions and 18 deletions
|
|
@ -38,24 +38,6 @@ func IsEmptyDir(p string) bool {
|
|||
return 1 > len(files)
|
||||
}
|
||||
|
||||
func IsValidJSON(p string) bool {
|
||||
if !gulu.File.IsExist(p) {
|
||||
return false
|
||||
}
|
||||
data, err := os.ReadFile(p)
|
||||
if nil != err {
|
||||
LogErrorf("read json file [%s] failed: %s", p, err)
|
||||
return false
|
||||
}
|
||||
|
||||
json := map[string]interface{}{}
|
||||
if err = gulu.JSON.UnmarshalJSON(data, &json); nil != err {
|
||||
LogErrorf("parse json file [%s] failed: %s", p, err)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func RemoveID(name string) string {
|
||||
ext := path.Ext(name)
|
||||
name = strings.TrimSuffix(name, ext)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue