From 49e5143de863588ab3f588b93cba7c3a4ac91a1d Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Thu, 16 Jun 2022 10:52:34 +0800 Subject: [PATCH] =?UTF-8?q?:fire:=20=E7=A7=BB=E9=99=A4=20IsValidJSON=20?= =?UTF-8?q?=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/util/file.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/kernel/util/file.go b/kernel/util/file.go index c68b4dd89..409fabd5c 100644 --- a/kernel/util/file.go +++ b/kernel/util/file.go @@ -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)