mitchellh / mapstructure

Go library for decoding generic map values into native Go structures and vice versa.
https://gist.github.com/mitchellh/90029601268e59a29e64e55bab1c5bdc
MIT License
7.93k stars 677 forks source link

decodeMapFromSlice should ignore ZeroFields when not first element #276

Open timestee opened 2 years ago

timestee commented 2 years ago

Thanks for this project, I've had a config file merge and load implementation using this project, and got a wired problem: https://github.com/sandwich-go/xconf/issues/6

https://github.com/mitchellh/mapstructure/blob/b9b99d7d59762a5b2a43df840adc318b2fa229ee/mapstructure.go#L823-L830 Should decodeMapFromSlice ignore ZeroFields when i != 0 ? Otherwise, the merged map will be clean again.