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

Examples should decapitalize yaml fields in struct #52

Open
sundowndev opened this issue Feb 2, 2020 · 4 comments
Open

Examples should decapitalize yaml fields in struct #52

sundowndev opened this issue Feb 2, 2020 · 4 comments

Comments

@sundowndev
Copy link

var Config = struct {
	Contacts []struct {
		Name  string
		Email string `required:"true"`
	}
}{}

configor.Load(&Config, "config.yml")
fmt.Println(Config)
// log: {[]}
contacts:
- name: i test
email: [email protected]
@gidoBOSSftw5731
Copy link

Can be fixed by decapitalizing Name, Contacts, and Email in your struct

@cbndr
Copy link

cbndr commented Jun 3, 2020

Works as designed - use proper indentation in your yaml file.

contacts:
  - name: i test
    email: [email protected]

@sundowndev
Copy link
Author

I think issue was I forgot to decapitalize fields (yaml:"name") in my struct, as @gidoBOSSftw5731 mentioned.

@sundowndev
Copy link
Author

Reopening so maintainer consider mentioning this in README examples.

@sundowndev sundowndev reopened this Jun 3, 2020
@sundowndev sundowndev changed the title empty values Examples should decapitalize yaml fields in struct Jun 3, 2020
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

3 participants