Commit bc45e901 authored by Kai Chen's avatar Kai Chen Committed by Matt Butcher

Remove unnecessary parentheses in switch statements (#3175)

parent 3ee50ccf
...@@ -60,19 +60,19 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { ...@@ -60,19 +60,19 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
return false, err return false, err
} }
switch value := obj.(type) { switch value := obj.(type) {
case (*v1.ReplicationController): case *v1.ReplicationController:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector) list, err := getPods(kcs, value.Namespace, value.Spec.Selector)
if err != nil { if err != nil {
return false, err return false, err
} }
pods = append(pods, list...) pods = append(pods, list...)
case (*v1.Pod): case *v1.Pod:
pod, err := kcs.Core().Pods(value.Namespace).Get(value.Name, metav1.GetOptions{}) pod, err := kcs.Core().Pods(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil { if err != nil {
return false, err return false, err
} }
pods = append(pods, *pod) pods = append(pods, *pod)
case (*extensions.Deployment): case *extensions.Deployment:
currentDeployment, err := kcs.Extensions().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{}) currentDeployment, err := kcs.Extensions().Deployments(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil { if err != nil {
return false, err return false, err
...@@ -87,37 +87,37 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error { ...@@ -87,37 +87,37 @@ func (c *Client) waitForResources(timeout time.Duration, created Result) error {
currentDeployment, currentDeployment,
} }
deployments = append(deployments, newDeployment) deployments = append(deployments, newDeployment)
case (*extensions.DaemonSet): case *extensions.DaemonSet:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels) list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels)
if err != nil { if err != nil {
return false, err return false, err
} }
pods = append(pods, list...) pods = append(pods, list...)
case (*appsv1beta1.StatefulSet): case *appsv1beta1.StatefulSet:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels) list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels)
if err != nil { if err != nil {
return false, err return false, err
} }
pods = append(pods, list...) pods = append(pods, list...)
case (*appsv1beta2.StatefulSet): case *appsv1beta2.StatefulSet:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels) list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels)
if err != nil { if err != nil {
return false, err return false, err
} }
pods = append(pods, list...) pods = append(pods, list...)
case (*extensions.ReplicaSet): case *extensions.ReplicaSet:
list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels) list, err := getPods(kcs, value.Namespace, value.Spec.Selector.MatchLabels)
if err != nil { if err != nil {
return false, err return false, err
} }
pods = append(pods, list...) pods = append(pods, list...)
case (*v1.PersistentVolumeClaim): case *v1.PersistentVolumeClaim:
claim, err := kcs.Core().PersistentVolumeClaims(value.Namespace).Get(value.Name, metav1.GetOptions{}) claim, err := kcs.Core().PersistentVolumeClaims(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil { if err != nil {
return false, err return false, err
} }
pvc = append(pvc, *claim) pvc = append(pvc, *claim)
case (*v1.Service): case *v1.Service:
svc, err := kcs.Core().Services(value.Namespace).Get(value.Name, metav1.GetOptions{}) svc, err := kcs.Core().Services(value.Namespace).Get(value.Name, metav1.GetOptions{})
if err != nil { if err != nil {
return false, err return false, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment