From: Matt Joiner Date: Fri, 26 Aug 2016 10:29:29 +0000 (+1000) Subject: Make bencode.Bytes work with pointer and nonpointer receivers X-Git-Tag: v1.0.0~610 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=8fd5942722b0287026049d3e6547532ff553d262;p=btrtrc.git Make bencode.Bytes work with pointer and nonpointer receivers --- diff --git a/bencode/bytes.go b/bencode/bytes.go index 483feb79..b196963b 100644 --- a/bencode/bytes.go +++ b/bencode/bytes.go @@ -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 }