(filePath string, jsonObject interface{})
| 97 | } |
| 98 | |
| 99 | func GetJsonObjectFromFile(filePath string, jsonObject interface{}) error { |
| 100 | data, err := ioutil.ReadFile(filePath) |
| 101 | if err != nil { |
| 102 | return err |
| 103 | } |
| 104 | // Remove the UTF-8 Byte Order Mark |
| 105 | data = bytes.TrimPrefix(data, []byte("\xef\xbb\xbf")) |
| 106 | |
| 107 | err = json.Unmarshal(data, jsonObject) |
| 108 | if err != nil { |
| 109 | return fmt.Errorf("json.Unmarshal %s error:%s", data, err) |
| 110 | } |
| 111 | return nil |
| 112 | } |
| 113 | |
| 114 | func GetStoreDirPath(dataDir, networkName string) string { |
| 115 | return dataDir + string(os.PathSeparator) + networkName |
no test coverage detected