Skip to content

decode: record Metadata.Keys for struct-to-map fields - #205

Open
team-humaki wants to merge 1 commit into
go-viper:mainfrom
team-humaki:metadata-struct-to-map-keys
Open

team-humaki wants to merge 1 commit into
go-viper:mainfrom
team-humaki:metadata-struct-to-map-keys

Conversation

@team-humaki

Copy link
Copy Markdown

decodeMapFromStruct copied exported fields into the result map without recording them, so DecodeMetadata left Keys empty when decoding a struct into a map.

The map-to-struct path already records Keys via decode(). This records the same metadata for the default (non-struct) struct-to-map assignment, and for remain-tag keys that are copied through.

Hidden (-) and unexported fields stay omitted, matching the decoded map.

Fixes #127

decodeMapFromStruct copied exported fields into the result map
without recording them, so DecodeMetadata left Keys empty.

Fixes go-viper#127
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

Successfully merging this pull request may close these issues.

Metadata doesn't seem to populate when Decoding from a Struct into a map

1 participant