// RawExtension intentionally avoids implementing value.UnstructuredConverter for now because the // signature of ToUnstructured does not allow returning an error value in cases where the conversion // is not possible (content type is unrecognized or bytes don't match content type). func rawToUnstructured(raw []byte, contentType string) (interface{ … } func (re RawExtension) guessContentType() string { … } func (re *RawExtension) UnmarshalJSON(in []byte) error { … } var cborNull … var cborSelfDescribed … func (re *RawExtension) UnmarshalCBOR(in []byte) error { … } // MarshalJSON may get called on pointers or values, so implement MarshalJSON on value. // http://stackoverflow.com/questions/21390979/custom-marshaljson-never-gets-called-in-go func (re RawExtension) MarshalJSON() ([]byte, error) { … } func (re RawExtension) MarshalCBOR() ([]byte, error) { … }