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

Make README.md example compile #130

Merged
merged 2 commits into from
Feb 27, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,20 @@ type ExampleConfig struct {
// Defines default config option
var (
defaultConfig = ExampleConfig{
Counter: 4,
Counter: string(4),
Copy link

@urso urso Feb 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

better keep 4 here and change the type of counter to int. The validators on Counter are numeric validators and won't work on strings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, I updated the pull-request with counter type int

}
)

func main() {
appConfig := defaultConfig // copy default config so it's not overwritten
config, err := yaml.NewConfigWithFile(path, ucfg.PathSep("."))
if err != nil {
fmt.Fprintln(err)
fmt.Println(err)
os.Exit(1)
}
err = config.Unpack(&appConfig)
if err != nil {
fmt.Fprintln(err)
fmt.Println(err)
os.Exit(1)
}
}
Expand Down