From 3443e00a82048617b358e9b809c0d7f9833498c5 Mon Sep 17 00:00:00 2001 From: Anis Hamidi Date: Sun, 5 Mar 2023 17:46:09 +0330 Subject: [PATCH] fix lint --- api/v1alpha1/team_webhook.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/v1alpha1/team_webhook.go b/api/v1alpha1/team_webhook.go index ce05b59..5bfd011 100644 --- a/api/v1alpha1/team_webhook.go +++ b/api/v1alpha1/team_webhook.go @@ -54,7 +54,9 @@ var teamns corev1.Namespace func (r *Team) ValidateCreate() error { teamlog.Info("validate create", "name", r.Name) clientset, err := getClinet() - + if err != nil { + return errors.New("fail to get clinet,can't not update team object") + } for _, ns := range r.Spec.Namespaces { //check if namespace does not exist or has been deleted @@ -83,7 +85,9 @@ func (r *Team) ValidateUpdate(old runtime.Object) error { teamlog.Info("validate update", "name", r.Name) clientset, err := getClinet() - + if err != nil { + return errors.New("fail to get clinet,can't not update team object") + } for _, ns := range r.Spec.Namespaces { //check if namespace does not exist or has been deleted @@ -125,7 +129,7 @@ func (r *Team) ValidateUpdate(old runtime.Object) error { exists = true } } - if exists == false { + if !exists { return errors.New("you can not remove the namespaces which have team label.") }