From 95cb1048b50300754aeee0f4e2d67385949d1817 Mon Sep 17 00:00:00 2001 From: Andrew Seigner Date: Tue, 24 Dec 2024 05:41:20 +0000 Subject: [PATCH] Add newlines to port-forward error output Some of the port-forward errors print to stderr without a newline. This can cause callers to inadvertently concatenate their own outputs to the lower-level error message. Add a `\n` to port-forward error outputs. Signed-off-by: Andrew Seigner --- cli/cmd/identity.go | 2 +- pkg/k8s/metrics.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cmd/identity.go b/cli/cmd/identity.go index 62e4c88eadd51..cab3ec9c843ba 100644 --- a/cli/cmd/identity.go +++ b/cli/cmd/identity.go @@ -183,7 +183,7 @@ func getContainerCertificate(k8sAPI *k8s.KubernetesAPI, pod corev1.Pod, containe defer portForward.Stop() if err = portForward.Init(); err != nil { - fmt.Fprintf(os.Stderr, "Error running port-forward: %s", err) + fmt.Fprintf(os.Stderr, "Error running port-forward: %s\n", err) return nil, err } diff --git a/pkg/k8s/metrics.go b/pkg/k8s/metrics.go index 15edfcc3cbfee..f21d07557475a 100644 --- a/pkg/k8s/metrics.go +++ b/pkg/k8s/metrics.go @@ -27,7 +27,7 @@ func GetContainerMetrics( defer portForward.Stop() if err = portForward.Init(); err != nil { - fmt.Fprintf(os.Stderr, "Error running port-forward: %s", err) + fmt.Fprintf(os.Stderr, "Error running port-forward: %s\n", err) return nil, err }