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

Function writeJSON

internal/editorconfig/json_tool.go:143–156  ·  view source on GitHub ↗
(path string, data map[string]any)

Source from the content-addressed store, hash-verified

141}
142
143func writeJSON(path string, data map[string]any) error {
144 if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
145 return fmt.Errorf("editorconfig: mkdir %s: %w", filepath.Dir(path), err)
146 }
147 encoded, err := json.MarshalIndent(data, "", " ")
148 if err != nil {
149 return fmt.Errorf("editorconfig: marshal %s: %w", path, err)
150 }
151 encoded = append(encoded, '\n')
152 if err := os.WriteFile(path, encoded, 0o600); err != nil {
153 return fmt.Errorf("editorconfig: write %s: %w", path, err)
154 }
155 return nil
156}

Callers 2

SetMethod · 0.70
UnsetMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected