From ac184d61fa26cc5dd562fbb6a7674810bd968649 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 7 Feb 2026 10:05:30 +0800 Subject: [PATCH] :art: Clean code https://github.com/siyuan-note/siyuan/pull/16894 Signed-off-by: Daniel <845765@qq.com> --- kernel/cache/asset.go | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/kernel/cache/asset.go b/kernel/cache/asset.go index fce48acdb..d3386e3a2 100644 --- a/kernel/cache/asset.go +++ b/kernel/cache/asset.go @@ -104,19 +104,6 @@ var ( assetsLock = sync.Mutex{} ) -// GetAssets 返回所有资源的副本 -func GetAssets() (ret map[string]*Asset) { - assetsLock.Lock() - defer assetsLock.Unlock() - - // 指定长度避免分配新内存时扩容和迁移 - ret = make(map[string]*Asset, len(assetsCache)) - for k, v := range assetsCache { - ret[k] = v - } - return -} - // IterateAssets 遍历所有资源,适合只读场景 func IterateAssets(fn func(path string, asset *Asset) bool) { assetsLock.Lock() @@ -134,7 +121,7 @@ func FilterAssets(filter func(path string, asset *Asset) bool) (ret map[string]* assetsLock.Lock() defer assetsLock.Unlock() - ret = make(map[string]*Asset) + ret = map[string]*Asset{} for path, asset := range assetsCache { if filter(path, asset) { ret[path] = asset