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

Support unmarshal nested interface type #331

Closed
jinleiw opened this issue Feb 26, 2020 · 3 comments
Closed

Support unmarshal nested interface type #331

jinleiw opened this issue Feb 26, 2020 · 3 comments

Comments

@jinleiw
Copy link
Contributor

jinleiw commented Feb 26, 2020

I think it's better to support nested Interface, For example:

type Conf struct {
     IntVal int
     InterVal interface{}
}

type NestedStruct struct {
    Name string
    Age int
}
var config Conf

config.InterVal = &NestedStruct{}

decoder.decode(&config)
@pelletier
Copy link
Owner

Nested structs should be supported. Do you mind trying with name and age as public attributes (capitalized names)?

@jinleiw
Copy link
Contributor Author

jinleiw commented Mar 2, 2020

Sorry, spelling mistakes. Yes, they are public attributes:

type NestedStruct struct {
    Name string
    Age int
}

jinleiw pushed a commit to jinleiw/go-toml that referenced this issue Mar 12, 2020
jinleiw pushed a commit to jinleiw/go-toml that referenced this issue Mar 12, 2020
@jinleiw
Copy link
Contributor Author

jinleiw commented Mar 12, 2020

Could you help me review the commit “75121fd”, if ok, then I open up a pull request. Thanks

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