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

Ensure that intermediate maps during struct to struct decoding are settable #203

merged 1 commit into from Jul 22, 2020


Copy link

@mkeeler mkeeler commented Jul 22, 2020

Fixes #202

Copy link

@mitchellh mitchellh left a comment

Looks good. I'm gonna merge as-is despite my comment. Its not a big deal. But note!

// indirection allows the underlying map to be settable (CanSet() == true)
// where as reflect.MakeMap returns an unsettable map.
addrVal := reflect.New(vMap.Type())

This comment has been minimized.


mitchellh Jul 22, 2020

If you know its a pointer I usually prefer addrVal.Elem() over indirect. Indirect just calls that with an additional check but it feels more idiomatic reflect usage. Same with the few other uses.

@mitchellh mitchellh merged commit fb53316 into mitchellh:master Jul 22, 2020
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
2 participants