If we use json.Marshal, we will get an empty string(Not an empty string, but an empty JSON like "{}").
If we use Encode in encoding/gob, we will get an error:
Error encoding: gob: type dbus.Variant has no exported fields
Do you want to implement the json interface? Or let others who use the type Variant to implement it in their own projects?
As described by @kolyshkin in https://github.com/opencontainers/runc/pull/3361#issuecomment-1028584575, we can't marshal a Variant variable as a json string.
If we use
json.Marshal
, we will get an empty string(Not an empty string, but an empty JSON like "{}"). If we useEncode
inencoding/gob
, we will get an error:Do you want to implement the
json interface
? Or let others who use the typeVariant
to implement it in their own projects?