From d957502528e08841819624f8e47786cf1abdf1cd Mon Sep 17 00:00:00 2001 From: YenForYang Date: Fri, 10 Sep 2021 17:26:43 -0500 Subject: [PATCH] Avoid allocating memory when checking interface (#588) Not a big deal, but there isn't a need to allocate an object to check that `*Node` satisfies `bencode.Unmarshaler`. --- metainfo/nodes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metainfo/nodes.go b/metainfo/nodes.go index 58504d92..ae7fdbb8 100644 --- a/metainfo/nodes.go +++ b/metainfo/nodes.go @@ -11,7 +11,7 @@ import ( type Node string var ( - _ bencode.Unmarshaler = new(Node) + _ bencode.Unmarshaler = (*Node)(nil) ) func (n *Node) UnmarshalBencode(b []byte) (err error) {