mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
client-go: refactor: Fix styling issues (#107248)
* client-go: Remove unreachable return Due to the way the switch statement is done, the return at the end of the function will neverbe reached. Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com> * client-go: Refactor for clarity Fixed one instance where the error message should be lowercase. Made the fields in the struct literal more explicit Signed-off-by: Ismayil Mirzali <ismayilmirzeli@gmail.com>
This commit is contained in:
parent
8a25964153
commit
75c0987de3
@ -231,7 +231,7 @@ var (
|
||||
|
||||
// Used to indicate that watching stopped because of a signal from the stop
|
||||
// channel passed in from a client of the reflector.
|
||||
errorStopRequested = errors.New("Stop requested")
|
||||
errorStopRequested = errors.New("stop requested")
|
||||
)
|
||||
|
||||
// resyncChan returns a channel which will receive something when a resync is
|
||||
@ -258,7 +258,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
|
||||
options := metav1.ListOptions{ResourceVersion: r.relistResourceVersion()}
|
||||
|
||||
if err := func() error {
|
||||
initTrace := trace.New("Reflector ListAndWatch", trace.Field{"name", r.name})
|
||||
initTrace := trace.New("Reflector ListAndWatch", trace.Field{Key: "name", Value: r.name})
|
||||
defer initTrace.LogIfLong(10 * time.Second)
|
||||
var list runtime.Object
|
||||
var paginatedResult bool
|
||||
@ -319,7 +319,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
|
||||
panic(r)
|
||||
case <-listCh:
|
||||
}
|
||||
initTrace.Step("Objects listed", trace.Field{"error", err})
|
||||
initTrace.Step("Objects listed", trace.Field{Key: "error", Value: err})
|
||||
if err != nil {
|
||||
klog.Warningf("%s: failed to list %v: %v", r.name, r.expectedTypeName, err)
|
||||
return fmt.Errorf("failed to list %v: %v", r.expectedTypeName, err)
|
||||
|
@ -813,7 +813,6 @@ func TestReflectorFullListIfExpired(t *testing.T) {
|
||||
t.Error(err)
|
||||
return nil, err
|
||||
}
|
||||
return nil, nil
|
||||
},
|
||||
}
|
||||
r := NewReflector(lw, &v1.Pod{}, s, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user