Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit 150368b

Browse files
togashidmkillianmuldoon
authored andcommitted
Change 'if-else block'
'if block' ends with a return statement,'else' droped and outdent made.
1 parent dc3e5e5 commit 150368b

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

pkg/cache/autoupdating_test.go

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ func TestNodeMetricsCache_PeriodicUpdate(t *testing.T) {
4040
if err != nil {
4141
if tt.wantErr {
4242
return
43-
} else {
44-
t.Error(err)
4543
}
44+
t.Error(err)
4645
}
4746
atStart, _ := n.ReadMetric(tt.queriedName)
4847
metrics.InstanceOfMockMetricClientMap[tt.queriedName] = tt.updatedMetric
@@ -51,9 +50,8 @@ func TestNodeMetricsCache_PeriodicUpdate(t *testing.T) {
5150
if err != nil {
5251
if tt.wantErr {
5352
return
54-
} else {
55-
t.Error(err)
5653
}
54+
t.Error(err)
5755
}
5856
if atStart[tt.queriedNode].Value == atEnd[tt.queriedNode].Value {
5957
log.Print(atStart[tt.queriedNode].Value, atEnd[tt.queriedNode].Value)
@@ -84,13 +82,11 @@ func TestNodeMetricsCache_ReadMetric(t *testing.T) {
8482
if !tt.wantErr {
8583
t.Errorf("AutoUpdatingCache.ReadMetric() error = %v", err)
8684
return
87-
} else {
88-
return
8985
}
90-
} else {
91-
if !reflect.DeepEqual(got, tt.want) {
86+
return
87+
}
88+
if !reflect.DeepEqual(got, tt.want) {
9289
t.Errorf("AutoUpdatingCache.ReadMetric() = %v, deleted %v", got, tt.want)
93-
}
9490
}
9591
})
9692
}
@@ -117,13 +113,11 @@ func TestNodeMetricsCache_ReadPolicy(t *testing.T) {
117113
if !tt.wantErr {
118114
t.Errorf("AutoUpdatingCache.ReadPolicy() error = %v / %v", err1, err2)
119115
return
120-
} else {
121-
return
122116
}
123-
} else {
124-
if !reflect.DeepEqual(got, tt.want) {
117+
return
118+
}
119+
if !reflect.DeepEqual(got, tt.want) {
125120
t.Errorf("AutoUpdatingCache.ReadPolicy() = %v, deleted %v", got, tt.want)
126-
}
127121
}
128122
if tt.wantErr {
129123
t.Errorf("no error fired")
@@ -155,9 +149,8 @@ func TestNodeMetricsCache_DeletePolicy(t *testing.T) {
155149
if !tt.wantErr {
156150
t.Errorf("AutoUpdatingCache.DeletePolicy() error = %v", err2)
157151
return
158-
} else {
159-
return
160152
}
153+
return
161154
}
162155
if tt.wantErr {
163156
t.Errorf("no error fired")

pkg/telemetrypolicy/api/v1alpha1/zz_generated_deepcopy.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ func (in *TASPolicy) DeepCopy() *TASPolicy {
2828
func (in *TASPolicy) DeepCopyObject() runtime.Object {
2929
if c := in.DeepCopy(); c != nil {
3030
return c
31-
} else {
32-
return nil
3331
}
32+
return nil
3433
}
3534

3635
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
@@ -62,9 +61,8 @@ func (in *TASPolicyList) DeepCopy() *TASPolicyList {
6261
func (in *TASPolicyList) DeepCopyObject() runtime.Object {
6362
if c := in.DeepCopy(); c != nil {
6463
return c
65-
} else {
66-
return nil
6764
}
65+
return nil
6866
}
6967

7068
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

0 commit comments

Comments
 (0)