MCPcopy Create free account
hub / github.com/CPChain/chain / readJSONFile

Function readJSONFile

tests/init_test.go:60–72  ·  view source on GitHub ↗
(fn string, value interface{})

Source from the content-addressed store, hash-verified

58}
59
60func readJSONFile(fn string, value interface{}) error {
61 file, err := os.Open(fn)
62 if err != nil {
63 return err
64 }
65 defer file.Close()
66
67 err = readJSON(file, value)
68 if err != nil {
69 return fmt.Errorf("%s in file %s", err.Error(), fn)
70 }
71 return nil
72}
73
74// findLine returns the line number for the given offset into data.
75func findLine(data []byte, offset int64) (line int) {

Callers 1

runTestFileMethod · 0.85

Calls 4

readJSONFunction · 0.85
OpenMethod · 0.65
CloseMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected