From 2d4703763d2a975d01b31a26a7b1b6169ce21862 Mon Sep 17 00:00:00 2001 From: Chen Su Date: Tue, 7 Jan 2025 11:09:20 +0800 Subject: [PATCH] Remove duplicated error check Signed-off-by: Chen Su --- pkg/minikube/node/cache.go | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/pkg/minikube/node/cache.go b/pkg/minikube/node/cache.go index d158c36b771e..da3900a56689 100644 --- a/pkg/minikube/node/cache.go +++ b/pkg/minikube/node/cache.go @@ -207,22 +207,20 @@ func beginDownloadKicBaseImage(g *errgroup.Group, cc *config.ClusterConfig, down // waitDownloadKicBaseImage blocks until the base image for KIC is downloaded. func waitDownloadKicBaseImage(g *errgroup.Group) { if err := g.Wait(); err != nil { - if err != nil { - if errors.Is(err, image.ErrGithubNeedsLogin) { - klog.Warningf("Error downloading kic artifacts: %v", err) - out.ErrT(style.Connectivity, "Unfortunately, could not download the base image {{.image_name}} ", out.V{"image_name": image.Tag(kic.BaseImage)}) - out.WarningT("In order to use the fall back image, you need to log in to the github packages registry") - out.Styled(style.Documentation, `Please visit the following link for documentation around this: + if errors.Is(err, image.ErrGithubNeedsLogin) { + klog.Warningf("Error downloading kic artifacts: %v", err) + out.ErrT(style.Connectivity, "Unfortunately, could not download the base image {{.image_name}} ", out.V{"image_name": image.Tag(kic.BaseImage)}) + out.WarningT("In order to use the fall back image, you need to log in to the github packages registry") + out.Styled(style.Documentation, `Please visit the following link for documentation around this: https://help.github.com/en/packages/using-github-packages-with-your-projects-ecosystem/configuring-docker-for-use-with-github-packages#authenticating-to-github-packages `) - } - if errors.Is(err, image.ErrGithubNeedsLogin) || errors.Is(err, image.ErrNeedsLogin) { - exit.Message(reason.Usage, `Please either authenticate to the registry or use --base-image flag to use a different registry.`) - } else { - klog.Errorln("Error downloading kic artifacts: ", err) - } - } + if errors.Is(err, image.ErrGithubNeedsLogin) || errors.Is(err, image.ErrNeedsLogin) { + exit.Message(reason.Usage, `Please either authenticate to the registry or use --base-image flag to use a different registry.`) + } else { + klog.Errorln("Error downloading kic artifacts: ", err) + } + } klog.Info("Successfully downloaded all kic artifacts") }