MCPcopy
hub / github.com/dnote/dnote / ReadJSON

Function ReadJSON

pkg/cli/testutils/main.go:112–121  ·  view source on GitHub ↗

ReadJSON reads JSON fixture to the struct at the destination address

(path string, destination interface{})

Source from the content-addressed store, hash-verified

110
111// ReadJSON reads JSON fixture to the struct at the destination address
112func ReadJSON(path string, destination interface{}) {
113 var dat []byte
114 dat, err := os.ReadFile(path)
115 if err != nil {
116 panic(errors.Wrap(err, "Failed to load fixture payload"))
117 }
118 if err := json.Unmarshal(dat, destination); err != nil {
119 panic(errors.Wrap(err, "Failed to get event"))
120 }
121}
122
123// NewDnoteCmd returns a new Dnote command and a pointer to stderr
124func NewDnoteCmd(opts RunDnoteCmdOptions, binaryName string, arg ...string) (*exec.Cmd, *bytes.Buffer, *bytes.Buffer, error) {

Callers 1

TestMigrateToV5Function · 0.92

Calls

no outgoing calls

Tested by 1

TestMigrateToV5Function · 0.74