()
| 762 | } |
| 763 | |
| 764 | func (r Ref) MarshalJSON() ([]byte, error) { |
| 765 | if !r.Valid() { |
| 766 | return null, nil |
| 767 | } |
| 768 | dname := r.digest.digestName() |
| 769 | bs := r.digest.bytes() |
| 770 | buf := make([]byte, 0, 3+len(dname)+len(bs)*2) |
| 771 | buf = append(buf, '"') |
| 772 | buf = r.appendString(buf) |
| 773 | buf = append(buf, '"') |
| 774 | return buf, nil |
| 775 | } |
| 776 | |
| 777 | // MarshalBinary implements Go's encoding.BinaryMarshaler interface. |
| 778 | func (r Ref) MarshalBinary() (data []byte, err error) { |
nothing calls this directly
no test coverage detected