From 86ed9ab695246f671bc68abc9070aeededf2707f Mon Sep 17 00:00:00 2001 From: siddharthist Date: Wed, 30 Dec 2015 16:03:50 -0600 Subject: [PATCH] Fix typo where port number was appended to host --- netstatus/netstatus.go | 2 +- netstatus/netstatus_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netstatus/netstatus.go b/netstatus/netstatus.go index 287ade4..30152a1 100644 --- a/netstatus/netstatus.go +++ b/netstatus/netstatus.go @@ -80,7 +80,7 @@ func PortOpen(protocol string, port uint16) bool { if err != nil { log.Fatal(err) } - return CanConnect("localhost"+fmt.Sprint(port), protocol, dur) + return CanConnect(fmt.Sprintf("localhost:%v", port), protocol, dur) } // ValidIP returns a boolean answering the question "is this a valid IPV4/6 diff --git a/netstatus/netstatus_test.go b/netstatus/netstatus_test.go index 7a1d70d..7100bc8 100644 --- a/netstatus/netstatus_test.go +++ b/netstatus/netstatus_test.go @@ -54,7 +54,7 @@ func TestOpenPorts(t *testing.T) { t.Errorf(msg+": %d", port) } else { dur, _ := time.ParseDuration("10s") - if CanConnect("localhost:"+fmt.Sprint(port), protocol, dur) { + if CanConnect(fmt.Sprintf("localhost:%v", port), protocol, dur) { couldConnect++ } }