From 9a19400b089b5ac6a747a0664557186551d542de Mon Sep 17 00:00:00 2001 From: "decauwsemaecker.glen@gmail.com" Date: Tue, 25 Apr 2017 10:01:39 -0500 Subject: [PATCH] simplify refact-left-over code --- consensus.go | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/consensus.go b/consensus.go index 8f7a1c3..9b65b69 100644 --- a/consensus.go +++ b/consensus.go @@ -119,10 +119,8 @@ func (c *Consensus) ExternalIP() (net.IP, error) { } // wait for all votes to come in, - // or until the voting process times out - select { - case <-waitWG(&wg): - } + // or until their process times out + wg.Wait() // if no votes were casted succesfully, // return early with an error @@ -148,14 +146,3 @@ func (c *Consensus) ExternalIP() (net.IP, error) { // we know it cannot be nil and is valid return net.ParseIP(externalIP), nil } - -// waitWG, waits for a waiting group, -// transformed into a channel to be composable. -func waitWG(wg *sync.WaitGroup) chan struct{} { - ch := make(chan struct{}) - go func() { - wg.Wait() - close(ch) - }() - return ch -}