Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Allow anonymous non struct fields #56

Closed
emilevauge opened this issue Oct 19, 2016 · 3 comments
Closed

Allow anonymous non struct fields #56

emilevauge opened this issue Oct 19, 2016 · 3 comments

Comments

@emilevauge
Copy link

emilevauge commented Oct 19, 2016

Hi!
I'm facing an issue on traefik traefik/traefik#743 that prevents us from using an anonymous slice field in a struct:

type Users []string

type Basic struct {
    Users `mapstructure:","` // explicitly don't squash 
}

Calling Decode() on Basic will produce the error Users: unsupported type: slice.
This behavior is due to the test

if fieldType.Anonymous {
which I'm not sure is needed as few lines later you have
if fieldKind != reflect.Struct {
.

Commenting the first test fixes my issue.
What are your thoughts on this?

@mitchellh
Copy link
Owner

Ah, sounds like a good bug I'll take a look today. Thanks!

@mitchellh
Copy link
Owner

Got it fixed :)

@emilevauge
Copy link
Author

Thanks for the quick fix @mitchellh 👍

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

No branches or pull requests

2 participants