From 3e0a27d7bbf61700c2ac93c5c58d2c723286a535 Mon Sep 17 00:00:00 2001 From: ahmed Date: Tue, 9 Jan 2024 13:19:42 -0500 Subject: [PATCH] combine splits --- pkg/detectors/postgres/postgres.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/detectors/postgres/postgres.go b/pkg/detectors/postgres/postgres.go index f22542e341b2..92a838ae75de 100644 --- a/pkg/detectors/postgres/postgres.go +++ b/pkg/detectors/postgres/postgres.go @@ -145,7 +145,8 @@ func findHosts(verify bool, hostnameMatches, portMatches [][]string) []string { if verify { var verifiedHosts []string for _, host := range hosts { - hostname, port := strings.Split(host, ":")[0], strings.Split(host, ":")[1] + parts := strings.Split(host, ":") + hostname, port := parts[0], parts[1] if postgresRunning(hostname, port) { verifiedHosts = append(verifiedHosts, host) }