MCPcopy Create free account
hub / github.com/JordanCoin/codemap / writeJSONAtomic

Function writeJSONAtomic

handoff/storage.go:96–106  ·  view source on GitHub ↗
(path string, value any)

Source from the content-addressed store, hash-verified

94}
95
96func writeJSONAtomic(path string, value any) error {
97 data, err := json.MarshalIndent(value, "", " ")
98 if err != nil {
99 return err
100 }
101 tmpPath := path + ".tmp"
102 if err := os.WriteFile(tmpPath, data, 0644); err != nil {
103 return err
104 }
105 return os.Rename(tmpPath, path)
106}
107
108func appendMetrics(root string, artifact *Artifact) error {
109 entry := struct {

Callers 1

WriteLatestFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected