Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading the config file into a string #2

Open
carstenhag opened this issue Aug 13, 2015 · 2 comments
Open

Loading the config file into a string #2

carstenhag opened this issue Aug 13, 2015 · 2 comments

Comments

@carstenhag
Copy link

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.

@olebedev
Copy link
Owner

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.

@carstenhag
Copy link
Author

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
#2 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants