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++ } }