]> Sergey Matveev's repositories - btrtrc.git/commitdiff
Make bencode.Bytes work with pointer and nonpointer receivers
authorMatt Joiner <anacrolix@gmail.com>
Fri, 26 Aug 2016 10:29:29 +0000 (20:29 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Fri, 26 Aug 2016 10:29:29 +0000 (20:29 +1000)
bencode/bytes.go

index 483feb792773c912b749c6d3279a5adb06662fda..b196963bdd40c7f4f74609246d0ec2fd18da1aca 100644 (file)
@@ -5,6 +5,7 @@ type Bytes []byte
 var (
        _ Unmarshaler = &Bytes{}
        _ Marshaler   = &Bytes{}
+       _ Marshaler   = Bytes{}
 )
 
 func (me *Bytes) UnmarshalBencode(b []byte) error {
@@ -12,6 +13,6 @@ func (me *Bytes) UnmarshalBencode(b []byte) error {
        return nil
 }
 
-func (me *Bytes) MarshalBencode() ([]byte, error) {
-       return *me, nil
+func (me Bytes) MarshalBencode() ([]byte, error) {
+       return me, nil
 }