mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
Merge pull request #47827 from yiqinguo/yiqinguo_repeat_type_coversions
Automatic merge from submit-queue Remove repeat type conversions Here is the type of conversion for the variable is repeated. **Release note**: ```release-note NONE ```
This commit is contained in:
commit
b697222103
@ -110,12 +110,14 @@ func tryDecodeSinglePod(data []byte, defaultFn defaultFunc) (parsed bool, pod *v
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, pod, err
|
return false, pod, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newPod, ok := obj.(*api.Pod)
|
||||||
// Check whether the object could be converted to single pod.
|
// Check whether the object could be converted to single pod.
|
||||||
if _, ok := obj.(*api.Pod); !ok {
|
if !ok {
|
||||||
err = fmt.Errorf("invalid pod: %#v", obj)
|
err = fmt.Errorf("invalid pod: %#v", obj)
|
||||||
return false, pod, err
|
return false, pod, err
|
||||||
}
|
}
|
||||||
newPod := obj.(*api.Pod)
|
|
||||||
// Apply default values and validate the pod.
|
// Apply default values and validate the pod.
|
||||||
if err = defaultFn(newPod); err != nil {
|
if err = defaultFn(newPod); err != nil {
|
||||||
return true, pod, err
|
return true, pod, err
|
||||||
@ -136,12 +138,14 @@ func tryDecodePodList(data []byte, defaultFn defaultFunc) (parsed bool, pods v1.
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return false, pods, err
|
return false, pods, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newPods, ok := obj.(*api.PodList)
|
||||||
// Check whether the object could be converted to list of pods.
|
// Check whether the object could be converted to list of pods.
|
||||||
if _, ok := obj.(*api.PodList); !ok {
|
if !ok {
|
||||||
err = fmt.Errorf("invalid pods list: %#v", obj)
|
err = fmt.Errorf("invalid pods list: %#v", obj)
|
||||||
return false, pods, err
|
return false, pods, err
|
||||||
}
|
}
|
||||||
newPods := obj.(*api.PodList)
|
|
||||||
// Apply default values and validate pods.
|
// Apply default values and validate pods.
|
||||||
for i := range newPods.Items {
|
for i := range newPods.Items {
|
||||||
newPod := &newPods.Items[i]
|
newPod := &newPods.Items[i]
|
||||||
|
Loading…
Reference in New Issue
Block a user