优化缓存机制 补充错误码

This commit is contained in:
2025-10-09 02:04:32 +08:00
parent 73480005eb
commit 84899f9935
10 changed files with 596 additions and 28 deletions
+19
View File
@@ -1,11 +1,30 @@
package cmd
import (
"complie-erlang/cache"
"complie-erlang/parser/zm_lib"
"fmt"
"github.com/spf13/cobra"
"os"
)
// 全局缓存
var globalCache = InitGlobalCache()
const globalCacheFileName = "global.json"
func InitGlobalCache() cache.Cache {
pathByExecutable, err := zm_lib.FindPathByExecutable(globalCacheFileName)
if err != nil {
panic("未查找到根目录 Err:" + err.Error())
}
newCache, err := cache.NewCache(pathByExecutable)
if err != nil {
panic("创建缓存失败 Err:" + err.Error())
}
return newCache
}
var rootCmd = &cobra.Command{
Use: "",
Short: "erlang注解生成配置模版工具",