Skip to content

Commit 664b1a6

Browse files
Volatusk8s-publishing-bot
authored andcommitted
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 <[email protected]> * 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 <[email protected]> Kubernetes-commit: 75c0987de3cb9a0380873745f68dea2f0835a7a2
1 parent 3618ec5 commit 664b1a6

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

tools/cache/reflector.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ var (
231231

232232
// Used to indicate that watching stopped because of a signal from the stop
233233
// channel passed in from a client of the reflector.
234-
errorStopRequested = errors.New("Stop requested")
234+
errorStopRequested = errors.New("stop requested")
235235
)
236236

237237
// resyncChan returns a channel which will receive something when a resync is
@@ -258,7 +258,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
258258
options := metav1.ListOptions{ResourceVersion: r.relistResourceVersion()}
259259

260260
if err := func() error {
261-
initTrace := trace.New("Reflector ListAndWatch", trace.Field{"name", r.name})
261+
initTrace := trace.New("Reflector ListAndWatch", trace.Field{Key: "name", Value: r.name})
262262
defer initTrace.LogIfLong(10 * time.Second)
263263
var list runtime.Object
264264
var paginatedResult bool
@@ -319,7 +319,7 @@ func (r *Reflector) ListAndWatch(stopCh <-chan struct{}) error {
319319
panic(r)
320320
case <-listCh:
321321
}
322-
initTrace.Step("Objects listed", trace.Field{"error", err})
322+
initTrace.Step("Objects listed", trace.Field{Key: "error", Value: err})
323323
if err != nil {
324324
klog.Warningf("%s: failed to list %v: %v", r.name, r.expectedTypeName, err)
325325
return fmt.Errorf("failed to list %v: %v", r.expectedTypeName, err)

tools/cache/reflector_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -813,7 +813,6 @@ func TestReflectorFullListIfExpired(t *testing.T) {
813813
t.Error(err)
814814
return nil, err
815815
}
816-
return nil, nil
817816
},
818817
}
819818
r := NewReflector(lw, &v1.Pod{}, s, 0)

0 commit comments

Comments
 (0)