MCPcopy Index your code
hub / github.com/jetify-com/devbox / JSON

Function JSON

internal/cachehash/hash.go:53–59  ·  view source on GitHub ↗

JSON marshals a to JSON and returns its hex-encoded hash.

(a any)

Source from the content-addressed store, hash-verified

51
52// JSON marshals a to JSON and returns its hex-encoded hash.
53func JSON(a any) (string, error) {
54 b, err := json.Marshal(a)
55 if err != nil {
56 return "", redact.Errorf("marshal to json for hashing: %v", err)
57 }
58 return Bytes(b), nil
59}
60
61// JSONFile compacts the JSON in a file and returns its hex-encoded hash.
62func JSONFile(path string) (string, error) {

Callers 5

isDirtyMethod · 0.92
addHashToEnvMethod · 0.92
HashMethod · 0.92
TestJSONFunction · 0.85
TestJSONUnsupportedTypeFunction · 0.85

Calls 2

ErrorfFunction · 0.92
BytesFunction · 0.85

Tested by 2

TestJSONFunction · 0.68
TestJSONUnsupportedTypeFunction · 0.68