Fixes #58.
@@ -74,8 +74,7 @@ func (e *encoder) marshal(tag string, in reflect.Value) {
return
}
in = reflect.ValueOf(v)
- }
- if m, ok := iface.(encoding.TextMarshaler); ok {
+ } else if m, ok := iface.(encoding.TextMarshaler); ok {
text, err := m.MarshalText()
if err != nil {
fail(err)
@@ -356,6 +356,10 @@ type marshalerType struct {
value interface{}
+func (o marshalerType) MarshalText() ([]byte, error) {
+ panic("MarshalText called on type with MarshalYAML")
+}
+
func (o marshalerType) MarshalYAML() (interface{}, error) {
return o.value, nil