MCPcopy Create free account
hub / github.com/Chat2AnyLLM/code-agent-manager / loadJSON

Function loadJSON

internal/editorconfig/json_tool.go:66–82  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

64}
65
66func loadJSON(path string) (map[string]any, string, error) {
67 data, err := os.ReadFile(path)
68 if err != nil {
69 if os.IsNotExist(err) {
70 return map[string]any{}, path, nil
71 }
72 return nil, path, fmt.Errorf("editorconfig: read %s: %w", path, err)
73 }
74 if len(data) == 0 {
75 return map[string]any{}, path, nil
76 }
77 out := map[string]any{}
78 if err := json.Unmarshal(data, &out); err != nil {
79 return nil, path, fmt.Errorf("editorconfig: parse %s: %w", path, err)
80 }
81 return out, path, nil
82}
83
84func (c *jsonToolConfig) LoadAll() map[string]ScopedConfig {
85 all := map[string]ScopedConfig{}

Callers 4

LoadMethod · 0.85
LoadAllMethod · 0.85
SetMethod · 0.85
UnsetMethod · 0.85

Calls 1

ReadFileMethod · 0.80

Tested by

no test coverage detected