This fixes a couple of things having to do with how we marshal structs
into Sentinel RPC objects:
The previous logic in toValue_struct for creating the list of elements
was basically running under the assumption that all struct fields were
exported and were not being skipped, by using a make call with a full
length based on the struct's NumField. This means that there's a
possibility of nils making it to the protobuf marshaling where they fail
because a protobuf message can't be nil. The fix is to use NumField for
capacity and set the initial length of the slice to 0, using append to
populate instead.
The behavior for field name conversion was also not matching with the
documentation - we were not converting field names to lowercase. This
has now been fixed - the default name for any field is now its lowercase
version, snake cased in the case of camel cased fields.
Also, there has been a lot of package-level documentation added to the
framework package to assist with guidance when using GoDoc as a
reference.
This fixes a couple of things having to do with how we marshal structs into Sentinel RPC objects:
The previous logic in toValue_struct for creating the list of elements was basically running under the assumption that all struct fields were exported and were not being skipped, by using a make call with a full length based on the struct's NumField. This means that there's a possibility of nils making it to the protobuf marshaling where they fail because a protobuf message can't be nil. The fix is to use NumField for capacity and set the initial length of the slice to 0, using append to populate instead.
The behavior for field name conversion was also not matching with the documentation - we were not converting field names to lowercase. This has now been fixed - the default name for any field is now its lowercase version, snake cased in the case of camel cased fields.
Also, there has been a lot of package-level documentation added to the framework package to assist with guidance when using GoDoc as a reference.