Fix unit tests and comments

Signed-off-by: z1cheng <imchench@gmail.com>
This commit is contained in:
z1cheng 2023-06-29 14:11:51 +00:00 committed by k8s-infra-cherrypick-robot
parent 4b6d0c0738
commit 1d8e7f4695
7 changed files with 17 additions and 40 deletions

View file

@ -18,6 +18,7 @@ package certs
import (
"fmt"
"os"
"github.com/spf13/cobra"
@ -47,7 +48,8 @@ func CreateCommand(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd.Flags().String("host", "", "Get the cert for this hostname")
if err := cobra.MarkFlagRequired(cmd.Flags(), "host"); err != nil {
fmt.Printf("error marking flag as required: %v", err)
util.PrintError(err)
os.Exit(1)
}
pod = util.AddPodFlag(cmd)
deployment = util.AddDeploymentFlag(cmd)

View file

@ -78,9 +78,7 @@ func execToWriter(args []string, writer io.Writer) error {
}
go func() {
if _, err := io.Copy(writer, op); err != nil {
fmt.Printf("Error copying output: %v\n", err)
}
io.Copy(writer, op) //nolint:errcheck
}()
err = cmd.Run()
if err != nil {