Open gallexis opened 3 years ago
In general, I'd expect an empty struct to marshel to an empty object (in our case, that would be an empty list). So I'd rather not handle struct{}
generically at the moment.
But in this case, map[string]struct{}
really just represents a set. That should probably marshal to an array of keys.
SGTY @whyrusleeping?
I needed to encode a
map[string]struct{}
but ran into this error :testing/cbor_gen.go:172:25: t.EmptyStruct.MarshalCBOR undefined (type struct {} has no field or method MarshalCBOR)
which is logical since we can't attach a function to an empty struct :So I made this fix to handle this case and added some tests