From 3daffb6dc345c6e1a811b5c21b88484d22602de2 Mon Sep 17 00:00:00 2001 From: jpts <james@cleverley-prance.uk> Date: Sat, 6 May 2023 14:37:02 +0100 Subject: [PATCH] fix: error handling for wildcard mode --- cmd/wildcard.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/wildcard.go b/cmd/wildcard.go index 4df8228..85d5a72 100644 --- a/cmd/wildcard.go +++ b/cmd/wildcard.go @@ -19,7 +19,7 @@ func wildcard(opts *cliOpts) ([]*svcResult, error) { return nil, err } - if len(res.additional) == 0 { + if res == nil || res.additional == nil { log.Debug().Msgf("No svcs for proto %s found", proto) continue } @@ -37,7 +37,7 @@ func wildcard(opts *cliOpts) ([]*svcResult, error) { svcs, _ = addUniqueSvcToSvcs(svcs, svc) } - if len(res.answers) == 0 { + if res.answers == nil { log.Debug().Msgf("No named ports for %s svcs found", proto) continue } @@ -58,7 +58,7 @@ func wildcard(opts *cliOpts) ([]*svcResult, error) { continue } - if len(res.answers) == 0 { + if res == nil || res.answers == nil { log.Debug().Msgf("svc %s/%s has no registered endpoints", svc.Namespace, svc.Name) continue }