Esempio n. 1
0
// Load load & remove comments from source .json file
func Load(fromPath string, toVar interface{}) {
	file, e := ioutil.ReadFile(fromPath)
	err.Panic(e)
	file = RemoveComment(file)
	err.Panic(json.Unmarshal(file, toVar))
}
Esempio n. 2
0
func LoadBuf(file []byte, toVar interface{}) {

	file = RemoveComment(file)
	err.Panic(json.Unmarshal(file, toVar))
}
Esempio n. 3
0
// Save config to json format file
func Save(fromVar interface{}, toPath string) {
	data, e := json.Marshal(fromVar)
	err.Panic(e)
	e = ioutil.WriteFile(toPath, data, 0664)
	err.Panic(e)
}