fix golint failures of pkg/volume/util/recyclerclient

This commit is contained in:
SataQiu 2019-04-24 00:01:34 +08:00
parent b384712024
commit d76f1a8fd6
3 changed files with 5 additions and 9 deletions

View File

@ -358,7 +358,6 @@ pkg/volume/scaleio
pkg/volume/storageos pkg/volume/storageos
pkg/volume/testing pkg/volume/testing
pkg/volume/util/fs pkg/volume/util/fs
pkg/volume/util/recyclerclient
pkg/volume/util/volumepathhandler pkg/volume/util/volumepathhandler
pkg/volume/vsphere_volume pkg/volume/vsphere_volume
plugin/pkg/admission/antiaffinity plugin/pkg/admission/antiaffinity

View File

@ -29,6 +29,7 @@ import (
"k8s.io/klog" "k8s.io/klog"
) )
// RecycleEventRecorder is a func that defines how to record RecycleEvent.
type RecycleEventRecorder func(eventtype, message string) type RecycleEventRecorder func(eventtype, message string)
// RecycleVolumeByWatchingPodUntilCompletion is intended for use with volume // RecycleVolumeByWatchingPodUntilCompletion is intended for use with volume
@ -127,9 +128,8 @@ func waitForPod(pod *v1.Pod, recyclerClient recyclerClient, podCh <-chan watch.E
if pod.Status.Phase == v1.PodFailed { if pod.Status.Phase == v1.PodFailed {
if pod.Status.Message != "" { if pod.Status.Message != "" {
return fmt.Errorf(pod.Status.Message) return fmt.Errorf(pod.Status.Message)
} else {
return fmt.Errorf("pod failed, pod.Status.Message unknown.")
} }
return fmt.Errorf("pod failed, pod.Status.Message unknown")
} }
case watch.Deleted: case watch.Deleted:
@ -238,9 +238,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
case eventEvent, ok := <-eventWatch.ResultChan(): case eventEvent, ok := <-eventWatch.ResultChan():
if !ok { if !ok {
return return
} else {
eventCh <- eventEvent
} }
eventCh <- eventEvent
} }
} }
}() }()
@ -256,9 +255,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
case podEvent, ok := <-podWatch.ResultChan(): case podEvent, ok := <-podWatch.ResultChan():
if !ok { if !ok {
return return
} else {
eventCh <- podEvent
} }
eventCh <- podEvent
} }
} }
}() }()

View File

@ -210,9 +210,8 @@ func (c *mockRecyclerClient) CreatePod(pod *v1.Pod) (*v1.Pod, error) {
func (c *mockRecyclerClient) GetPod(name, namespace string) (*v1.Pod, error) { func (c *mockRecyclerClient) GetPod(name, namespace string) (*v1.Pod, error) {
if c.pod != nil { if c.pod != nil {
return c.pod, nil return c.pod, nil
} else {
return nil, fmt.Errorf("pod does not exist")
} }
return nil, fmt.Errorf("pod does not exist")
} }
func (c *mockRecyclerClient) DeletePod(name, namespace string) error { func (c *mockRecyclerClient) DeletePod(name, namespace string) error {