Loading the config file into a string
The Documentation ommits how to load the yaml/json file into a string,
Here's how I did it:
file, readErr := ioutil.ReadFile("config.yaml")
if readErr != nil {
fmt.Println("Could not read config.yaml:", readErr)
// Maybe exit the program?
}
yamlConfig := string(file)
// parse the file etc
This would be useful to include in the docs. Also putting some of the documentation's example code into the README.md would be great.
Yep, you right. README.md needed to be improved totally. I'll do it in nearest future. But I don't mind if some good man send me a PR :)
By the way, there are a lot of tips how to use it at godoc.
I will submit a PR if I have the time ;)
I read over the godoc but it doesn't say anything about loading the cfg from a file, the example provided uses a string stored in the go file.
2015-08-13 11:14 GMT+02:00 Oleg Lebedev [email protected]:
Yep, you right. README.md needed to be improved totally. I'll do it in nearest future. But I don't mind if some good man send me a PR :)
By the way, there are a lot of tips how to use it at godoc http://godoc.org/github.com/olebedev/config.
— Reply to this email directly or view it on GitHub https://github.com/olebedev/config/issues/2#issuecomment-130587431.