Exemplo 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))
}
Exemplo n.º 2
0
func LoadBuf(file []byte, toVar interface{}) {

	file = RemoveComment(file)
	err.Panic(json.Unmarshal(file, toVar))
}
Exemplo 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)
}