purpleidea / mgmt

Next generation distributed, event-driven, parallel config management!
https://purpleidea.com/tags/mgmtconfig/
GNU General Public License v3.0
3.67k stars 315 forks source link

engine: util: Skip unexported fields in struct field mapping #685

Closed frebib closed 2 years ago

frebib commented 2 years ago

Unexported fields should be ignored when mapping structs from Golang to mcl, as this avoids issues where certain structs cannot be used in mcl representation due to their structure that may be incompatible with conversion. Disallowing private fields allows those to still be included in the struct but ignored when mapping the types, allowing the mcl representation of the type to stil be valid

Resolves: https://github.com/purpleidea/mgmt/issues/684 Signed-off-by: Joe Groocock me@frebib.net

frebib commented 2 years ago

So this is apparently a 1.17 feature 🤔

purpleidea commented 2 years ago

Looks beautiful, thanks. How much do I have to pay to add a simple test? =D

purpleidea commented 2 years ago

Sorry for the long delay in merging. If someone would like to write a test for this situation, it would certainly be appreciated.