From 86e65e589d469bcdf87c84e6b5d47744cfbc8d2d Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 29 Oct 2018 12:38:03 +0200 Subject: [PATCH] don't stand on your head to take a pointer the whole stack argument doesn't make much sense in golang; escape analysis should allocate in heap. --- pubsub.go | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/pubsub.go b/pubsub.go index 2e48c5b..d90249f 100644 --- a/pubsub.go +++ b/pubsub.go @@ -434,14 +434,9 @@ func (p *PubSub) doAnnounceRetry(pid peer.ID, topic string, sub bool) { return } - // don't take pointers to the goroutine stack - topicP := new(string) - subP := new(bool) - *topicP = topic - *subP = sub subopt := &pb.RPC_SubOpts{ - Topicid: topicP, - Subscribe: subP, + Topicid: &topic, + Subscribe: &sub, } out := rpcWithSubs(subopt)