package pluginmgr import ( "encoding/json" "fmt" "os" ) func LoadPluginConfigWithFile(filePath string) (map[string]*PluginProcessConf, error) { data, err := os.ReadFile(filePath) // TODO: change to util.ReadFile if err != nil { return nil, err } return LoadPluginConfigWithData(data) } func LoadPluginConfigWithData(data []byte) (map[string]*PluginProcessConf, error) { plgCfgMap := make(map[string]*PluginProcessConf) err := json.Unmarshal(data, &plgCfgMap) if err != nil { return nil, fmt.Errorf("json unmarshal plugin config err: %v", err) } return plgCfgMap, nil }