Closed frebib closed 3 years ago
Replace use of reflect.Value.Len() with NumField() which is intended to return the number of fields in reflected Struct value.
Len should only be used for Array, Chan, Map, Slice and String types.
Add some trivial sanity check tests for ValueOf() for the simple and complex container types.
Signed-off-by: Joe Groocock me@frebib.net
This looks perfect, and a nice catch too! Thank you =D
Woops. I didn't merge this, because it fails tests. One sec, I'll post output
Merged in https://github.com/purpleidea/mgmt/commit/845d7ff188480737070c19a6178502e517746120 \o/
Replace use of reflect.Value.Len() with NumField() which is intended to return the number of fields in reflected Struct value.
Len should only be used for Array, Chan, Map, Slice and String types.
Add some trivial sanity check tests for ValueOf() for the simple and complex container types.
Signed-off-by: Joe Groocock me@frebib.net