Skip to content

Commit d76f1a8

Browse files
committed
fix golint failures of pkg/volume/util/recyclerclient
1 parent b384712 commit d76f1a8

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

hack/.golint_failures

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,6 @@ pkg/volume/scaleio
358358
pkg/volume/storageos
359359
pkg/volume/testing
360360
pkg/volume/util/fs
361-
pkg/volume/util/recyclerclient
362361
pkg/volume/util/volumepathhandler
363362
pkg/volume/vsphere_volume
364363
plugin/pkg/admission/antiaffinity

pkg/volume/util/recyclerclient/recycler_client.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"k8s.io/klog"
3030
)
3131

32+
// RecycleEventRecorder is a func that defines how to record RecycleEvent.
3233
type RecycleEventRecorder func(eventtype, message string)
3334

3435
// RecycleVolumeByWatchingPodUntilCompletion is intended for use with volume
@@ -127,9 +128,8 @@ func waitForPod(pod *v1.Pod, recyclerClient recyclerClient, podCh <-chan watch.E
127128
if pod.Status.Phase == v1.PodFailed {
128129
if pod.Status.Message != "" {
129130
return fmt.Errorf(pod.Status.Message)
130-
} else {
131-
return fmt.Errorf("pod failed, pod.Status.Message unknown.")
132131
}
132+
return fmt.Errorf("pod failed, pod.Status.Message unknown")
133133
}
134134

135135
case watch.Deleted:
@@ -238,9 +238,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
238238
case eventEvent, ok := <-eventWatch.ResultChan():
239239
if !ok {
240240
return
241-
} else {
242-
eventCh <- eventEvent
243241
}
242+
eventCh <- eventEvent
244243
}
245244
}
246245
}()
@@ -256,9 +255,8 @@ func (c *realRecyclerClient) WatchPod(name, namespace string, stopChannel chan s
256255
case podEvent, ok := <-podWatch.ResultChan():
257256
if !ok {
258257
return
259-
} else {
260-
eventCh <- podEvent
261258
}
259+
eventCh <- podEvent
262260
}
263261
}
264262
}()

pkg/volume/util/recyclerclient/recycler_client_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ func (c *mockRecyclerClient) CreatePod(pod *v1.Pod) (*v1.Pod, error) {
210210
func (c *mockRecyclerClient) GetPod(name, namespace string) (*v1.Pod, error) {
211211
if c.pod != nil {
212212
return c.pod, nil
213-
} else {
214-
return nil, fmt.Errorf("pod does not exist")
215213
}
214+
return nil, fmt.Errorf("pod does not exist")
216215
}
217216

218217
func (c *mockRecyclerClient) DeletePod(name, namespace string) error {

0 commit comments

Comments
 (0)