From 43b2508990d52b77424a80146dc01c8e9bc3cf95 Mon Sep 17 00:00:00 2001 From: Josh Pinkney Date: Tue, 14 Sep 2021 11:36:16 -0400 Subject: [PATCH] Rename kubernetes error import to k8sErrors --- pkg/terminal/operator.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkg/terminal/operator.go b/pkg/terminal/operator.go index 3d4fa9c1ebb..228a660603e 100644 --- a/pkg/terminal/operator.go +++ b/pkg/terminal/operator.go @@ -2,8 +2,8 @@ package terminal import ( "context" - goErrors "errors" - "k8s.io/apimachinery/pkg/api/errors" + "errors" + k8sErrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" "k8s.io/apimachinery/pkg/runtime/schema" @@ -44,7 +44,7 @@ func checkWebTerminalOperatorIsRunning() (bool, error) { _, err = client.AdmissionregistrationV1().MutatingWebhookConfigurations().Get(context.TODO(), webhookName, metav1.GetOptions{}) if err != nil { - if errors.IsNotFound(err) { + if k8sErrors.IsNotFound(err) { return false, nil } return false, err @@ -52,7 +52,7 @@ func checkWebTerminalOperatorIsRunning() (bool, error) { _, err = client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Get(context.TODO(), webhookName, metav1.GetOptions{}) if err != nil { - if errors.IsNotFound(err) { + if k8sErrors.IsNotFound(err) { return false, nil } return false, err @@ -66,13 +66,12 @@ func checkWebTerminalOperatorIsInstalled() (bool, error) { _, err := GetWebTerminalSubscriptions() if err != nil { // Web Terminal subscription is not found but it's technically not a real error so we don't want to propogate it. Just say that the operator is not installed - if errors.IsNotFound(err) { + if k8sErrors.IsNotFound(err) { return false, nil } return false, err } - return true, nil } @@ -100,7 +99,7 @@ func GetWebTerminalSubscriptions() (*unstructured.UnstructuredList, error) { func GetWebTerminalNamespace(subs *unstructured.UnstructuredList) (string, error) { if len(subs.Items) > 1 { - return "", goErrors.New("found multiple subscriptions for web-terminal when only one should be found") + return "", errors.New("found multiple subscriptions for web-terminal when only one should be found") } webTerminalSubscription := subs.Items[0]