From 333e7717fbe458e3059a33f61a8b6c79bda9d2e1 Mon Sep 17 00:00:00 2001 From: Kapil Sharma Date: Tue, 7 May 2024 10:35:02 +0530 Subject: [PATCH] not using fmt Signed-off-by: Kapil Sharma --- events/helper/inbound_connection.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/events/helper/inbound_connection.go b/events/helper/inbound_connection.go index 2cb2f2e7..4d7ede5d 100644 --- a/events/helper/inbound_connection.go +++ b/events/helper/inbound_connection.go @@ -15,8 +15,8 @@ limitations under the License. package helper import ( - "fmt" "net" + "strconv" "github.com/falcosecurity/event-generator/events" ) @@ -29,9 +29,7 @@ func InboundConnection(h events.Helper) error { if err != nil { return err } - fmt.Println("Server started on", address) defer listener.Close() - fmt.Println("Server closed on", address) return nil } @@ -57,7 +55,7 @@ func getRandomLocalAddress() (string, error) { continue } listener.Close() - return fmt.Sprintf("%s:%d", ip, listener.Addr().(*net.TCPAddr).Port), nil + return ip.String() + ":" + strconv.Itoa(listener.Addr().(*net.TCPAddr).Port), nil } - return "", fmt.Errorf("no valid local address found") + return "", err }