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

Default values for slices of embedded structs are not working #67

Open
ajanata opened this issue Mar 16, 2018 · 2 comments
Open

Default values for slices of embedded structs are not working #67

ajanata opened this issue Mar 16, 2018 · 2 comments

Comments

@ajanata
Copy link

ajanata commented Mar 16, 2018

Similar to #13, but the problem is if you have a slice of a struct, the default values aren't getting applied. I took a stab at trying to figure out what's going on here, but didn't really get anywhere productive.

@cihangir
Copy link
Contributor

Hey @ajanata could you please share an example config/struct that fails?

@ajanata
Copy link
Author

ajanata commented Mar 19, 2018

Hi @cihangir,

I've made a branch that contains a test case for this: ajanata@f9657fe

It fails as such:

defaultslice_test.go:90: Test file defaultslice.toml, NestedField value is wrong: , want: nested
defaultslice_test.go:90: Test file defaultslice.json, NestedField value is wrong: , want: nested
defaultslice_test.go:90: Test file defaultslice.yaml, NestedField value is wrong: , want: nested

I also used the same struct directly, not as a slice, and the default value tag works as intended there (and is also tested).

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